ShotgunEventDaemon can't run in background

We are implementing ShotgunEventDaemon for some systematic task.
It runs perfectly when run in Foreground but I’m unable to launch it in background using start argument.
Here’s the error I get:

[ws] user ~ >python3 /prod/studio/libs/python/3.6/linux/site-packages/shotgunEvents/src/ start
Traceback (most recent call last):
File “/prod/studio/libs/python/3.6/linux/site-packages/shotgunEvents/src/”, line 1418, in
File “/prod/studio/libs/python/3.6/linux/site-packages/shotgunEvents/src/”, line 1382, in main
File “/prod/studio/libs/python/3.6/linux/site-packages/shotgunEvents/src/”, line 1353, in start
super(LinuxDaemon, self).start(daemonize)
File “/prod/studio/libs/python/3.6/linux/site-packages/shotgunEvents/src/”, line 115, in start
File “/prod/studio/libs/python/3.6/linux/site-packages/shotgunEvents/src/”, line 74, in _daemonize
se = open(self._stderr, “a+”, 0)
ValueError: can’t have unbuffered text I/O

Any clue on what could cause this error? Thank!

Nothing different with Python3.7

1 Like

Odds are you need to be ‘root’ to run this as a daemon (presumably due to the system-level permissions required for a process to be properly registered as a daemon). I’ve never had any success running it as a non-root user.


Thank you for your reply.
Unfortunately, I’ve just tested it as root and I get the exact same error.

This looks like a bug, I’ll run it past the team. As far as I can see you can only pass 0 as a buffer parameter if you’re are using binary.

OK, thanks.

Should I start a support ticket then? or will you update this forum post?

Could you try opening the file in binary mode, a+b?


So I’ve changed line 74 of from:

    se = open(self._stderr, "a+", 0)


     se = open(self._stderr, "a+b", 0)

I didn’t get any error this time but the daemon is not running. There is a pid register in the log file but this pid is not running.

1 Like

Hi Philip, when could I expect a return from the team on this matter?

Hi, I’ve added an internal ticket for this, we’ll update this thread when it’s resolved.

1 Like