Question

I'm newbie in jython please find my learing environment details

JYTHON : Jython 2.5.4rc1 (2.5:723492dbab02, Feb 8 2013, 09:50:55) JAVA : [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_01 PYTHON : Python 3.3 IDE : PyDev on Juno Service Release 1 OS : Windows 7, 64 bit

While trying to run a program which I took from the internet. This program expects some inputs from the end user (C, M or X) something like :

enterPlayer = input("Would you like to create a team or manage an existing team?\n (Enter 'C' for create, 'M' for manage, 'X' to exit) ") This workks fine if run this program with python (using pydev). But if run this as a jython, the program breaks down and if I print the enterPlayer [print (enterPlayer.upper())] variable (the varable which stores the input from the user) the value is shown as "__PYCLASSPATH__/".

i.e the program works as intended if i choose python otherwise (jython) it breaks.

Please help

Was it helpful?

Solution

input : raw_input = Python 3.x : Python 2.x

If you want to run your program both in Python 3.x and Python 2.x (Jython 2.x), Put following lines at the beginning of your program.

import sys
if sys.hexversion < 0x3000000:
    input = raw_input
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top