Re: Having trouble converting popen2 to subprocess

2006-11-18 Thread Daniel Klein
Thanks /F, that was it. Dan On Sat, 18 Nov 2006 15:03:30 +0100, Fredrik Lundh <[EMAIL PROTECTED]> wrote: [snip] >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() > > -- http://mail.python.org/m

Re: Having trouble converting popen2 to subprocess

2006-11-18 Thread Fredrik Lundh
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,

Re: Having trouble converting popen2 to subprocess

2006-11-18 Thread tom
Daniel Klein wrote: > Here's a c routine that prints a single line : > > #include > main() > { > printf ("Hello World!\n"); > } > > And now the Python program (called 'po.py') that uses 'popen2' : > > import popen2 > (fin, fout) = popen2.popen2(r'c:\home\hw.exe', -1, 't') > print fin.readline()

Having trouble converting popen2 to subprocess

2006-11-18 Thread Daniel Klein
Here's a c routine that prints a single line : #include main() { printf ("Hello World!\n"); } And now the Python program (called 'po.py') that uses 'popen2' : import popen2 (fin, fout) = popen2.popen2(r'c:\home\hw.exe', -1, 't') print fin.readline() fin.close() fout.close() When this is run