Questions regarding the daemon module.

Chris Rebert clp2 at rebertia.com
Sat Jan 28 15:05:25 EST 2012


On Sat, Jan 28, 2012 at 5:54 AM, David Lambert <dave at lambsys.com> wrote:
> I was looking for a simple way to daemonize a Python process, and found:
>
> http://www.python.org/dev/peps/pep-3143/
>
> I used easy_install to add this package (I thought), but when I attempted to
> use the example in the above link, I got the error:
>
>
> AttributeError: 'module' object has no attribute 'DaemonContext'
>
> To my surprise when looking at the module that was installed, I found
> something completely different to what was in the documentation:
>
>>>> dir(daemon)
> ['__builtins__', '__doc__', '__file__', '__name__', '__package__',
> 'basic_daemonize', 'checkPID', 'daemonize', 'errno', 'os', 'sys',
> 'writePID']
>>>>
>>>> print daemon.__doc__
> None
>>>>
>>>> print daemon.daemonize.__doc__
> None
>>>>
>
>
> Further experimentation with this module yielded a working daemon, but I am
> concerned regarding its parentage and lack of documentation. Could someone
> explain these discrepancies?

You seem to have installed the "daemon" package:
http://pypi.python.org/pypi/daemon/
If you read the PEP more closely, you'll see that the PEP 3143
reference implementation is instead the "python-daemon" package:
http://pypi.python.org/pypi/python-daemon/

Both packages provide modules named "daemon", partially hence your confusion.

Cheers,
Chris



More information about the Python-list mailing list