Kevin Walzer wrote:
Hello,
I'm trying to move from os.popen to using subprocess, and I'm having
trouble with the pipe suddenly closing.
My old code looked something like this:
<cut code and rest>
Hi Kevin,
You could try something more like:
>>> import subprocess
>>> cmd = subprocess.Popen([executable_path, executable_options],
stdout=subprocess.PIPE, stdout=subprocess.PIPE)
>>> std_out, std_err = cmd.communicate(standard_in_value)
std_out is a string though, you probably need to split it on newline to
get the same sort of list and since it is buffered in memory you
probably don't want to use .communicate if you expect megabytes of data
back.
--
mph
--
http://mail.python.org/mailman/listinfo/python-list