stdin broken on Win2K?

Steve Holden sholden at holdenweb.com
Fri Sep 28 21:11:33 EDT 2001


"Dale Strickland-Clark" <dale at riverhall.NOSPAMco.uk> wrote in message
news:43u9rtsgorpj5fh4r07hkoakkh9bkh2u22 at 4ax.com...
> This:
>
> # stdintest.py
> # Copy stdin to stdout
>
> import sys
> l = sys.stdin.readline()
> while l:
> print l,
> l = sys.stdin.readline()
>
>
> doesn' work from the Win2K command prompt in either of the following
> cases:
>
> stdintest <source.txt
> type source.txt | stdintest
>
> However, if you don't redirect stdin, it will happily reflect console
> input to the console.
>
> Why should I get eof immediately when reading from a file but not when
> from the console and what might I do to overcome this?
>
I doubt you'll be surprised to learn this, but it isn't a problem with
Python but a problem with the command shell distributed with Win NT and 2K.
You can work around it by invoking your script as an argument to the
"python" command rather than relying on file associations.

don't-shoot-the-messenger-ly y'rs  - steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list