470,648 Members | 1,435 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 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).


Sep 10 '08 #1
0 1477

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

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 | 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.