stdin broken on Win2K?

Dale Strickland-Clark dale at riverhall.NOSPAMco.uk
Fri Sep 28 18:29:43 EDT 2001


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?

Thanks for any help.
--
Dale Strickland-Clark
Riverhall Systems Ltd



More information about the Python-list mailing list