S
Sholtz
Hi,
I am trying to figure out how to 'control' the input & output using
popen/popen2 etc on Python 2.3
I have found examples for unix such as the one below but I can't get it to
work on Windows NT.
If I use the os.popen module I can read OR write not both.
Anybody have any ideas?
Regards,
Sholto.
# Open command in a pipe
# which reads from stdin and writes to stdout
import popen2
pipe = popen2.Popen4("wc -l") # Unix command
pipe.tochild.write("line 1\nline 2\nline 3\n")
pipe.tochild.close()
output = pipe.fromchild.read()
I am trying to figure out how to 'control' the input & output using
popen/popen2 etc on Python 2.3
I have found examples for unix such as the one below but I can't get it to
work on Windows NT.
If I use the os.popen module I can read OR write not both.
Anybody have any ideas?
Regards,
Sholto.
# Open command in a pipe
# which reads from stdin and writes to stdout
import popen2
pipe = popen2.Popen4("wc -l") # Unix command
pipe.tochild.write("line 1\nline 2\nline 3\n")
pipe.tochild.close()
output = pipe.fromchild.read()