[issue2571] cmd.py always uses raw_input, even when another stdin is specified

Daniel Diniz report at bugs.python.org
Mon Apr 7 21:48:59 CEST 2008


Daniel Diniz <ajaksu2 at users.sourceforge.net> added the comment:

I don't think it should stop using raw_input just because you changed
stdin, as you can change it to something that will work with raw_input.
Consider:
>>> import sys
>>> sys.stdin = open("/dev/tty")
>>> raw_input()
a
'a'

You can tie it to any object (e.g. a GUI input) that supports the file
protocol and keep using raw_input. Or change Cmd.use_rawinput to 0 to
use stdin.readline directly.

On a related issue. Cmd.use_rawinput should be "True", not 1...

----------
nosy: +ajaksu2

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2571>
__________________________________


More information about the Python-bugs-list mailing list