[Tutor] Python 3.2 - Running in Idle but not in command window

Alan Gauld alan.gauld at btinternet.com
Wed Apr 13 18:57:49 CEST 2011


"Gary Beynon" <garybeynon at hotmail.co.uk> wrote

> I do have ArcGIS (Python 2.6) & Python 2.5 installed.  
Are these causing a problem?

Yes, in Python v2 input will return the numeric version 
of the number - ie it converts from the string. 
In Python v3 - which is what your program expects - input 
always returns a string.

If you explicitly convert choice to an int and return 
that from menu and then test for the int option in 
your main code it should work in both Python versions.

Either that or change the file association in Windows 
to always pick up Version 3 - but that may not be 
good if you have other v2 scripts on your PC...

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list