[Tutor] Use of POPEN

Bob Gordon rgordon9 at swbell.net
Tue Jul 13 23:28:01 CEST 2004

I am trying to redirect a spawned program's input stream using the following:
import os
pipe = os.popen('myprog.exe', 'w')
when I perform the write, I receive the following error msg:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 22] Invalid argument

I am running under Windows2000.  When launched, myprog.exe starts by printing some information to stdout and then waits for input from stdin.
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040713/08d4447f/attachment.htm

More information about the Tutor mailing list