From: Jeff A. <re...@bu...> - 2013-05-11 14:10:49
|
New submission from Jeff Allen: 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() abcdef 'abcdef\n' >>> 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). ---------- assignee: jeff.allen components: Core keywords: console messages: 8009 nosy: amak, emcdowell, jeff.allen severity: normal status: open title: sys.stdin.readline() hangs when used interactively (JLine, Windows) type: behaviour versions: Jython 2.5, Jython 2.7 _______________________________________ Jython tracker <re...@bu...> <http://bugs.jython.org/issue2046> _______________________________________ |