stdin broken on Win2K?

Tim Peters tim.one at home.com
Fri Sep 28 20:12:31 EDT 2001


[Dale Strickland-Clark]
> 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.

Try these instead:

python stdintest.py <source.txt
type source.txt | python stdintest.py

If those work for you, complain to Microsoft about cmd.exe (the default
Win2K shell), or buy a commercial shell, or install Cygwin and use the
bundled bash shell.





More information about the Python-list mailing list