Odd problem with I/O redirection under Windows

Chris Liechti cliechti at gmx.net
Sun May 19 21:44:43 EDT 2002


Peter <pcc at ecet.vtc.edu> wrote in 
news:MPG.1751f29eea0a0866989682 at news.sover.net:
> 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?

this thread/message might be of interest (one line):

http://groups.google.com/groups?hl=en&lr=&ie=utf-8&oe=utf-
8&selm=a6oad3%24lai%240%40216.39.172.122&rnum=6

i'm sure there are other threads about this when you search on 
google.groups.com

you're not the first one with that problem ;-)

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list