[Tutor] (no subject)
ktprktpr at yahoo.com
Sun Dec 12 06:55:06 CET 2004
I am trying to supply input to another program using
pipes. I can read from it just fine, but writing to
its stdin doesn't seem to be working.
foo.py (gets pipe to listen.py)
from popen2 import popen2
cmd = "listen.py"
r, w = popen2(cmd)
got = r.readlines()
for line in got:
# wrote to this stdin, so uh should have message
uh = raw_input("why doesn't it")
if "" != uh:
print "go here?"
if "" == uh:
print "or even here?"
I know I'm missing something conceptual...
I only get "why doesn't it" printed to the screen and
the message didn't seem to transfer across the pipe,
as listen.py aborted before the if statement somehow.
Any and all help would be appreciated; popen2._test()
works fine ...
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the Tutor