subprocess + python-daemon - bug/problem?

Ben Finney ben+python at benfinney.id.au
Thu Aug 13 12:00:17 CEST 2009


Ben Finney <ben+python at benfinney.id.au> writes:

> My first thought was perhaps it's related to the fact that the process
> has no stdout? But setting ‘stdout’ and ‘stderr’ to the same file::
> 
>     #! /usr/bin/python
> 
>     import daemon
>     import subprocess
> 
>     fake_console = open("fake_console.txt", "w+")
>     daemon.DaemonContext(stdout=fake_console, stderr=fake_console).open()
>     subprocess.Popen(['echo', '1']).wait()

For newcomers to this thread: the ‘daemon’ module is provided by the
<URL:http://pypi.python.org/pypi/python-daemon> ‘python-daemon’
distribution, of which I am the maintainer.

> still gives the same error::
> 
>     1
>     Traceback (most recent call last):
>       File "/home/bignose/Projects/python/python-daemon/bin/andy-clegg-test", line 8, in <module>
>         subprocess.Popen(['echo', '1']).wait()
>       File "/usr/lib/python2.5/subprocess.py", line 1184, in wait
>         pid, sts = self._waitpid_no_intr(self.pid, 0)
>       File "/usr/lib/python2.5/subprocess.py", line 1014, in _waitpid_no_intr
>         return os.waitpid(pid, options)
>     OSError: [Errno 10] No child processes
> 
> I'm not familiar enough with the nuances of the ‘subprocess’ module to
> know what might be going wrong here. I'd like to know whether it might
> be a problem in the ‘python-daemon’ library.

I am no closer to a solution on this one. I don't have enough experience
or knowledge of the ‘subprocess’ module to know whether it's a bug in
‘subprocess’, a bug in ‘python-daemon’, or a hard-to-track interaction
between the two.

Any narrowing of the problem would be appreciated.

-- 
 \        “I bought a dog the other day. I named him Stay. It's fun to |
  `\     call him. ‘Come here, Stay! Come here, Stay!’ He went insane. |
_o__)         Now he just ignores me and keeps typing.” —Steven Wright |
Ben Finney



More information about the Python-list mailing list