Odd problem with I/O redirection under Windows
Peter
pcc at ecet.vtc.edu
Sun May 19 20:21:06 EDT 2002
Hello!
I just wrote a Python program that starts out with
text = sys.stdin.readlines()
This behaves itself fine when I run the program interactively and type
the input manually. However when I do something like:
C:\> myscript < somefile.txt
I get:
Traceback (most recent call last):
File "C:\home\prog\Python\myscript.py", line 30, in ?
text = sys.stdin.readlines()
IOError: [Errno 9] Bad file descriptor
I'm using the "standard" Python v2.2 download for Windows.
Curiously when I try running the very same program using Cygwin's python
v2.2 in a bash shell on the same machine it works fine. Thus I'm
thinking this might have something to do with how the Windows Python is
handling the console. I'm running Win2k if that matters.
Any thoughts?
Peter
More information about the Python-list
mailing list