Title: Raw_input broken in Windows REPL
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: emcdowell, jeff.allen, zyasoft
Priority: Keywords:

Created on 2014-05-20.18:37:41 by emcdowell, last changed 2014-05-21.20:22:26 by zyasoft.

msg8449 (view) Author: Edward McDowell (emcdowell) Date: 2014-05-20.18:37:40
The raw_input function does not work properly at the REPL in Jython 2.7b2 on java1.8.0_05 on Windows 7 or 8.  It appears to work in scripts.

When raw_input is issued in the REPL the prompt never appears and it is necessary to press CTRL/C or CTRL/Z to abort the read (which also aborts Jython).  Everything works fine when reading using sys.stdin.readline(), the exact opposite of a problem in jython2.7b1 which I reported last year.


C:\Users\emcdowell\progs\jython>java -jar jython.jar
Jython 2.7b2 (default:a5bc0032cf79+, Apr 22 2014, 21:20:17)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.8.0_05
>>> import sys
>>> line = sys.stdin.readline()
My input text.
>>> line
'My input text.\n'
>>> # Works!
>>> →

C:\Users\emcdowell\progs\jython>java -jar jython.jar
Jython 2.7b2 (default:a5bc0032cf79+, Apr 22 2014, 21:20:17)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.8.0_05
>>> line = raw_input('Prompt? ')
... My input text.
... →

msg8450 (view) Author: Edward McDowell (emcdowell) Date: 2014-05-20.19:22:21
The following examples show that everything works from scripts.  This is a REPL problem.

line = raw_input('Prompt? ')
print repr(line)

H:\user\python\jytest>java -jar jython.jar
Prompt? My text.
'My text.'

import sys
sys.stdout.write('Prompt? ')
line = sys.stdin.readline()

H:\user\python\jytest>java -jar jython.jar
Prompt? My text.
'My text.\n'

msg8452 (view) Author: Jeff Allen (jeff.allen) Date: 2014-05-20.19:53:06
Not quite your environment, but it works for me:

Jython 2.7b2+ (default:a5bc0032cf79, May 20 2014, 20:40:23)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_51
Type "help", "copyright", "credits" or "license" for more information.
>>> line = raw_input('Prompt? ')
Prompt? My input test.
>>> exit()
msg8455 (view) Author: Edward McDowell (emcdowell) Date: 2014-05-20.21:00:58
I downloaded the incorrect jar file: jython-2.7b2.jar.  Everything works with jython-standalone-2.7b2.jar.  The link at the upper-right corner of the Jython homepage points to the former file, which is missing some required codecs.  You may want to update that link to point to the complete download page, where I found the link to the correct standalone file.

I reported the original problem with the previous versions of Jython with Windows and appreciate the work you have done over the past year getting everything to work.
msg8456 (view) Author: Jim Baker (zyasoft) Date: 2014-05-21.20:22:25
OP reports it's now working on the latest beta, which matches what Jeff and I observe. Closing.
Date User Action Args
2014-05-21 20:22:26zyasoftsetstatus: open -> closed
resolution: invalid
messages: + msg8456
nosy: + zyasoft
2014-05-20 21:00:58emcdowellsetmessages: + msg8455
2014-05-20 19:53:07jeff.allensetnosy: + jeff.allen
messages: + msg8452
2014-05-20 19:22:21emcdowellsetmessages: + msg8450
2014-05-20 18:37:41emcdowellcreate