os.popen3 hangs in Windows XP SP1, SP2. Python 2.5 & 2.4. Consistent test case.

Thomas Guettler guettli.usenet at thomas-guettler.de
Tue Dec 12 10:11:53 EST 2006


Pierre Rouleau wrote:

> Hi all,
>
> I have a consistent test case where os.popen3() hangs in Windows.  The
> system hangs when retrieving the lines from the child process stdout.
> I know there were several reports related to os.popen3() hanging under
> Windows in this group before.

I had a problem like this some time ago. But it was a problem that
would happen under any operating system.

If there is output on stdout and stderr, you will get a dead lock sooner
or later.

Example: The childprocess tries to write to stderr, and the
parent process reads from stdin. The buffer of stderr will
get full. The child will block. The parent will wait for ever.

See http://docs.python.org/lib/popen2-flow-control.html

My hint: Always use popen4

You can get dead locks with popen4, too. But only if you
write to pipe.tochild.

  Thomas

-- 
Thomas Güttler, http://www.thomas-guettler.de/ http://www.tbz-pariv.de/
E-Mail: guettli (*) thomas-guettler + de
Spam Catcher: niemand.leermann at thomas-guettler.de




More information about the Python-list mailing list