Python deadlock using subprocess.popen and communicate

Atherun atherun at gmail.com
Thu Sep 22 11:55:40 EDT 2011


On Sep 22, 12:24 am, Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-
a470-7603bd3aa... at spamschutz.glglgl.de> wrote:
> Am 22.09.2011 05:42 schrieb Atherun:
>
> > I'm pretty sure thats the problem, this is a generic catch all
> > function for running subprocesses.  It can be anything to a simple
> > command to a complex command with a ton of output.  I'm looking for a
> > better solution to handle the case of running subprocesses that have
> > an undetermined amount of output.
>
> Just handle process.stdout/stderr by yourself - read it out until EOF
> and then wait() for the process.
>
> Thomas

Thats what confuses me though, the documentation says
process.stdout.read()/stderr.read() can deadlock and apparently so can
communicate, how do you read the stdout/stderr on yourself if its
documented using them can cause a deadlock?



More information about the Python-list mailing list