467,184 Members | 1,250 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,184 developers. It's quick & easy.

Re: subprocess.Popen hangs at times?

Kenneth McDonald wrote:
When making calls of the form Popen(cmd, shell=True,
stdout=subprocess.PIPE), we've been getting occasional, predictable
hangs. Will Popen accumulate a certain amount of stdout and then block
until its read? We don't want to use threads, so just want to read the
entire stdout after the subprocess has finished.
The subprocess module has already an API method for your use case. The
communicate() method of a subprocess.Popen instance takes an optional
stdin string and returns the stdout and stderr output as strings. The
method uses the best low level functions possible (select() on Unix,
threads on Windows).

Christian

Sep 10 '08 #1
  • viewed: 1015
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by gregpinero@gmail.com | last post: by
12 posts views Thread by bhunter | last post: by
1 post views Thread by Marko Rauhamaa | last post: by
7 posts views Thread by skunkwerk | last post: by
2 posts views Thread by dudeja.rajat@gmail.com | last post: by
reply views Thread by Kenneth McDonald | last post: by
reply views Thread by Fredrik Lundh | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.