[Tutor] Wrong version of Python being executed

Martin Walsh mwalsh at groktech.org
Sun Nov 11 06:13:10 CET 2007


Tony Cappellini wrote:
>>> What do you get if you print sys.path from
>> the interpreter?
> 
> I've printed out sys.path from inside the script as well,
> and all references to Python25 are replaced with Python23
> 
> 
> FWIW- This isn't a problem unique to this script.
> I've just printed out sys.path from another script in another
> directory, and Python2.3 is referenced.
> So, it's a system wide issue- but I still don't know how or why it's happening.

That is odd.

Try using the full path to python, just to be sure: c:\python25\python
script.py -- do you get the same behavior?

Also, if you haven't already, you can run python with the -E and/or -S
flags (ex. 'c:\python25\python -E -S script.py'). The -E flag will cause
the PYTHONPATH and PYTHONHOME environment variables to be ignored. And
the -S flag prevents 'import site' at python startup. Regardless, even
if these are configured incorrectly I would expect the same behavior if
running a script or using the interactive interpreter.

You mentioned that python 2.4 is installed also... does it have the same
sys.path problem?

HTH,
Marty




More information about the Tutor mailing list