Message30996
| Author |
doko |
| Recipients |
| Date |
2007年01月12日.10:34:13 |
| SpamBayes Score |
| Marked as misclassified |
| Message-id |
| In-reply-to |
| Content |
[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.
|
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2007年08月23日 14:51:14 | admin | link | issue1633941 messages |
| 2007年08月23日 14:51:14 | admin | create |
|