IO Error From raw_input() in Jython
When I try to use raw_input on my Ubuntu machine in Jython 2.2.1 on Java 1.6.0_07 I get an empty IOError when executing a python file, but not when using a python shell:
-- raw_input.py --
raw_input()
>> jython raw_input.py
Traceback (innermost last):
File "raw_input.py", line 1, in ?
IOError:
-- console --
>>> raw_input()
hello
'hello'To get round this I just use sys.stdin.readline().strip() to read a line from stdin and remove the trailing newline character.