By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,679 Members | 1,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,679 IT Pros & Developers. It's quick & easy.

Re: subprocess.Popen hangs at times?

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.