New submission from Silvio Ricardo Cordeiro: The following code works on python2 (tested with 2.7.6), but breaks readline for python3 (tested with 3.4.3):
>>> import sys, readline >>> sys.stdin = open('/dev/tty', 'r') >>> input("> ") # press "7<Enter>" >>> input("> ") # press "up" key Re-opening /dev/tty as stdin is a very useful technique. For example, one could debug a script that takes a file as stdin by re-opening the stdin as /dev/tty and using pdb.set_trace(). See bug report for python2 in 2002 here: https://bugs.python.org/issue512981 ---------- components: Library (Lib) messages: 286521 nosy: silvioricardoc priority: normal severity: normal status: open title: Re-opening /dev/tty breaks readline versions: Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29396> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com