Weirdness with python and stdin redirection under Win32

Tim Roberts timr at probo.com
Fri Dec 6 02:19:36 EST 2002


Thomas Heller <theller at python.net> wrote:

>Norbert.Klamann at klamann-software.de (Norbert Klamann) writes:
>
>> "Jonathan M. Gilligan" <jonathan.gilligan at vanderbilt.edu> wrote in message news:<asjset$n3l$1 at news.vanderbilt.edu>...
>> 
>> > I am getting an error reading stdin only when I invoke a python script by
>> > typing "bar | foo.py" or "foo.py < bar", but not when typing "bar | python
>> > foo.py" or "python foo.py < bar". The error arises ecause when input is
>> > redirected, stdin has fileno = -1 if the script is invoked as "foo.py", but
>> > correctly has fileno = 0 if it is invoked as "python foo.py"
>> 
>> If I remember correctly this is a Windows bug, it was mentioned sometimes on this
>> list.
>> 
>Right, but it is fixed in Win2k (and hopefully also on XP).

I'm afraid not.  The bug certainly DOES exist in Win2K, and I suspect it
also exists in XP.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list