[Tutor] Wrong version of Python being executed

Tony Cappellini cappy2112 at gmail.com
Mon Nov 12 05:37:03 CET 2007

Message: 2
Date: Sun, 11 Nov 2007 16:57:01 -0600
From: Martin Walsh <mwalsh at groktech.org>
Subject: Re: [Tutor] Wrong version of Python being executed
To: Tutor Python <tutor at python.org>
Message-ID: <473788BD.7060806 at groktech.org>
Content-Type: text/plain; charset=ISO-8859-1

>>My initial thought based on your description was that python2.5 is
being invoked with PYTHON* env
>>vars from a previous install, or some site module weirdness.

Not sure how the "previous install" surfaced, but I installed all
python installations and packages on my computer.

I have to switch between 2.3 and 2.5, so to make it easy, I use an
environment variable called CURRENT_PYTHON.
(someone on this list or the wxPython list told me I should NOT use
PYTHONPATH and modify it the way I am using CURRENT_PYTHON)

(The existing path isn't shown, only for brevity)

Note, these are entered in Ctrl Panel, System environment variables,
NOT at the command line.

>>But, the fact that running python.exe with it's full path corrects the issue,
>>seems to indicate a problem with your PATH, rather than any python
Yes, my conclusion also, but what is wrong with the path?
I've posted the contents of PATH in the original email or one of the
subsequent ones.

>>Would the following be an accurate description of the behavior?

>>- you run inside a fresh 'cmd' console each time (typing 'cmd' at the
>>run dialog, or similar), to be sure there is no app environment kruft


>>- the current working directory doesn't contain any programs, scripts or
>>possibly links that could interfere (preferably an empty path)

Not that I can see

>>- you don't have any PYTHON* environment vars set (including PYTHONSTARTUP)

No- see for yourself. No python anything variables.
C:\Documents and Settings\z30032as>set python
Environment variable python not defined

>>you observe:
>>- when you type 'python' (only 'python') at the prompt, you get
>>python2.5 interactively


>>- when you use the form 'python script.py', the script is run with
>>python2.3 (can you verify with sys.version?) with sys.path appropriate
>>for 2.3


>>- when you use the form 'c:\python25\python.exe script.py', the script
>>is executed with python2.5 and you have the correct sys.path (for 2.5)

>>I wouldn't think so, but I suppose it is possible. I believe all the
>>pertinent registry keys are store under
>>"HKLM\Software\Python\Pythoncore\<version>", so you could have a look.

Already did. There IS a PYTHONPATH entry for each of the 3 versions of
Python I have installed.
They are all identical, with the exception of the last 2 digits for
the Python version.
This looks ok to me. No other rogue entries of PYTHONPATH were found
in the registry.

>>BTW, are you using an alternate distribution of python (ex.
>>ActiveState), or the standard python.org version?

No. I always use the regular Python.Org distributions. I never
understood what was so special about ActiveState anyway.
I;d rather have full control of my installs, and all the packages.
Although, at this point, I'm not in control over what is happening
with my path ;-)

More information about the Tutor mailing list