Weirdness with python and stdin redirection under Win32
Thomas Heller
theller at python.net
Wed Dec 4 07:29:54 EST 2002
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).
Thomas
More information about the Python-list
mailing list