Hi,
I am trying to communicate with a subprocess via the subprocess
module. Consider the following example:
>>> from subprocess import Popen, PIPE
>>> Popen("""python -c 'input("hey")'""", shell=True)
<subprocess.Popen object at 0x729f0>
>>> hey
Here hey is immediately print to stdout of my interpreter, I did not
type in the "hey". But I want to read from the output into a string,
so I do
>>> x = Popen("""python -c 'input("hey\n")'""", shell=True, stdout=PIPE,
>>> bufsize=2**10)
>>> x.stdout.read(1)
# blocks forever
Is it possible to read to and write to the std streams of a
subprocess? What am I doing wrong?
Regards,
-Justin
--
http://mail.python.org/mailman/listinfo/python-list