subprocess + python-daemon - bug/problem?
Ben Finney
ben+python at benfinney.id.au
Fri Jul 10 07:30:41 EDT 2009
Andy Clegg <andy2.0 at gmail.com> writes:
> "import daemon
> import subprocess
>
> daemon.DaemonContext(stderr = open("fakeConsole.txt","w+")).open()
> subprocess.Popen(['echo','1']).wait()"
>
> However the error remains the same.
The error appears in the file specified for the stderr output of the
DaemonContext. Here it is without the unwanted extra line-wrapping that
seems to plague all Google Mail users (seriously, folks: get a real mail
provider that won't mangle your messages)::
Traceback (most recent call last):
File "/home/bignose/Projects/python/python-daemon/bin/andy-clegg-test", line 7, 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 confirm that I'm getting the same error; Python 2.5.4.
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()
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.
--
\ “Whatever a man prays for, he prays for a miracle. Every prayer |
`\ reduces itself to this: “Great God, grant that twice two be not |
_o__) four.”” —Ivan Turgenev |
Ben Finney
More information about the Python-list
mailing list