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