Author jeff.allen
Recipients amak, emcdowell, jeff.allen
Date 2013-05-11.14:10:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This behaviour was identified by Edward McDowell during discussion of Issue #1972, which it resembles, but differs from. Quoting from there ...

...(emcdowell) sys.stdin.readline() hangs on Windows as well.  This problem persists in both jython 254RC1 and 27b1.  raw_input must be used to successfully read from the keyboard.  I have encountered this problem using the standalone jar distributions on both Windows 7 and Windows XP. To reproduce the problem:

Start the jython shell: java -jar jython.jar
>>> import sys
>>> sys.stdin.readline()
Type a line of input.  Will hang.

A work-around is to use the alternative console org.python.util.InteractiveConsole although one loses the interactive line recall, of course.

dev>jython -Dpython.console=org.python.util.InteractiveConsole
Jython 2.7b1+ (default:1af38173c96d, Feb 12 2013, 15:40:07)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_35
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.stdin.readline()

The root cause of this behaviour is known to be that the JLine console reprogrammes the Windows console to deliver single keystrokes exactly as types. In particular, \r is no longer translated to the system end of line (\r\n for Windows), which is what TextIOWrapper is looking for during readline. It also no longer traps the keyboard interrupt ctrl-C (see Issue #1313).
Date User Action Args
2013-05-11 14:10:41jeff.allensetrecipients: + jeff.allen, amak, emcdowell
2013-05-11 14:10:41jeff.allensetmessageid: <>
2013-05-11 14:10:40jeff.allenlinkissue2046 messages
2013-05-11 14:10:40jeff.allencreate