Having trouble converting popen2 to subprocess

Fredrik Lundh fredrik at pythonware.com
Sat Nov 18 09:03:30 EST 2006


Daniel Klein wrote:

> Now here is my attempt to use the 'subprocess' module :
> 
> from subprocess import *
> p = Popen(r'c:\home\hw.exe', bufsize=-1, stdin=PIPE, stdout=PIPE,
> universal_newlines=True)
> fin = p.stdin

p.stdin is the *other* process' stdin.  if you want to read things it 
prints, read from p.stdout instead.

> print fin.readline()
> fin.close()

</F>




More information about the Python-list mailing list