On Fri, Jul 20, 2012 at 1:51 AM, Jason Friedman <ja...@powerpull.net> wrote:

> > This seems to work okay but just now I got this while hitting ctrl-c
> > It seems to have caught the signal at or in the middle of a call to
> > sys.stdout.flush()
> >
> >
> > --- Caught SIGTERM; Attempting to quit gracefully ---
> > Traceback (most recent call last):
> >   File "/home/user/test.py", line 125, in <module>
> >     sys.stdout.flush()
> > IOError: [Errno 4] Interrupted system call
> >
> >
> > How should I fix this?
> > Am I doing this completely wrong?
>
> Instead of rolling your own others have written Python code to
> implement daemons.  Try a search on "Python daemon".
>

I found a stackoverflow question that linked to this...
http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
... I'm not sure how that would help.  They don't attempt to exit
gracefully.
I don't think my problem is the daemon part, it is the handling the SIGTERM
signal where I'm having trouble.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to