Subprocess does not return for longer-running process

Nobody nobody at
Wed Sep 22 18:38:28 CEST 2010

On Tue, 21 Sep 2010 23:54:04 -0700, Dennis Lee Bieber wrote:

>> As your Traceback clearly indicates, the Popen() call has already
>> completed; it's *the os.waitpid() call* that's blocking, but that's
>> entirely to be expected given its defined behavior. If you don't want
>> to wait around for the process to die, then don't call waitpid() on it
>> in the first place!
> 	And a likely reason the waitpid() if blocking is that the
> sub-process is blocking trying to write to pipe that is full.

Which is why you should always use the .communicate() method if you
redirect two or more of std{in,out,err} to a pipe (this is why the Unix
popen() function only lets you redirect one of the standard descriptors).

And I can't think of any reason why you should use os.waitpid() or
similar; use the .wait() method.

More information about the Python-list mailing list