Message30996
[forwarded from http://bugs.debian.org/315888]
for line in sys.stdin: doesn't notice EOF the first time when reading from tty.
The test program:
import sys
for line in sys.stdin:
print line,
print "eof"
A sample session:
liw@esme$ python foo.py
foo <--- I pressed Enter and then Ctrl-D
foo <--- then this appeared, but not more
eof <--- this only came when I pressed Ctrl-D a second time
liw@esme$
Seems to me that there is some buffering issue where Python needs to
read end-of-file twice to notice it on all levels. Once should be
enough.
|
|
Date |
User |
Action |
Args |
2007-08-23 14:51:14 | admin | link | issue1633941 messages |
2007-08-23 14:51:14 | admin | create | |
|