<DIV>I am trying to redirect a spawned program's input stream using the following:</DIV>
<DIV> </DIV>
<DIV>import os</DIV>
<DIV>pipe = os.popen('myprog.exe', 'w')</DIV>
<DIV>pipe.write('stuff\n')</DIV>
<DIV>pipe.close()</DIV>
<DIV> </DIV>
<DIV>when I perform the write, I receive the following error msg:</DIV>
<DIV><BR>Traceback (most recent call last):<BR> File "<stdin>", line 1, in ?<BR>IOError: [Errno 22] Invalid argument<BR></DIV>
<DIV>I am running under Windows2000. When launched, myprog.exe starts by printing some information to stdout and then waits for input from stdin.</DIV>
<DIV> </DIV>
<DIV>Do I also have to redirect stdout using popen2, for example, or will the output from myprog go to the bit bucket? If the later, then why do I receive the error dealing with stdin?</DIV>