[issue6467] raw_input() doesn't work as expected when it gets multiple ^D

Lucas Prado Melo report at bugs.python.org
Sun Jul 12 13:57:25 CEST 2009


New submission from Lucas Prado Melo <lucaspradomelo at gmail.com>:

----------------------------------
$ cat raw_input_test.py
s = ''
try:
    while True:
        c = raw_input()
	print c
	s += c
except EOFError:
    pass
$ python raw_input_test.py
test^D^Dtes
^D
$ python --version
Python 2.7a0
$ bash --version
GNU bash, version 3.2.48(1)-release (i486-pc-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
----------------------------------

Surprisingly, though:

----------------------------------
$ python raw_input_test.py > output
test^D^D^D
$ cat output
test
----------------------------------
^D = Press Ctrl+D

I am using Ubuntu 9.04 (Jaunty Jackalope).

----------
components: IO
messages: 90443
nosy: lucaspmelo
severity: normal
status: open
title: raw_input() doesn't work as expected when it gets multiple ^D
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6467>
_______________________________________


More information about the Python-bugs-list mailing list