Passing File Objects into Subprocess.Popen
solipsis at pitrou.net
Thu Nov 4 23:39:54 CET 2010
On Thu, 04 Nov 2010 17:13:09 -0500
Brandon Harris <brandon.harris at reelfx.com> wrote:
> I'm running python 2.5 and have bumped into an issue whereby the PIPE
> in subprocess.Popen locks up after taking too many characters. I found
> some documentation that discuss this problem and offers some ideas for
> solutions, the best one being to pass a file object into subprocess
> instead of PIPE.
This sounds rather unlikely. Have you used communicate()?
> process = subprocess.Popen(my_cmd, stderr=my_stderr, stdout=my_stdout)
> print my_stderr.read()
> print my_stdout.read()
Try to rewind the file pointer before reading from it.
More information about the Python-list