Program stalls when called via Popen4?

Paul Boddie paul at boddie.net
Fri Mar 21 18:21:25 CET 2003


Joshua Pollak <joshp at cra.com> wrote in message news:<Vrqea.6493$io.248058 at iad-read.news.verio.net>...
> 
> Everything seems to be working correctly, EXCEPT that the popen2.Popen4
> instance I'm using to actually build our project never returns. When I
> 'watch' what the subprocess is doing by using 'ps aux', it seems that it
> has stalled on the first call to 'echo'!

Quite often with popen2 functions, it can be advisable to close the
output stream to the child process. For example (with popen3, since I
don't know what popen4 returns):

  t = popen2.popen3(command)
  # Close output, which is the standard input of the command.
  t[1].close()
  # Read from t[0] and t[2].

That might prevent certain blocking conditions from occurring.

Paul




More information about the Python-list mailing list