[Tutor] Wrong version of Python being executed

Martin Walsh mwalsh at groktech.org
Mon Nov 12 15:51:16 CET 2007


Alan Gauld wrote:
> "Tony Cappellini" <cappy2112 at gmail.com> wrote
> 
>> 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)
>>
>> CURRENT_PYTHON=C:\PYTHON2X
>> path=%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.

That seems like a perfectly rational approach, and good advice.

Unfortunately I don't have a windows machine to test/confirm at the
moment, but IIRC you can set both user-space and system-wide environment
variables this way. I think PATH is special, in that user-space PATH is
appended to the *end* of the system-wide PATH, where other vars set in
user-space override the system defaults? Is it possible you have
python23 in your system-wide path, and you've edited user-space path to
include %CURRENT_PYTHON%?

Regardless, as a test you might try to add C:\Python25 to the front of
your system-wide PATH temporarily. This should aid in diagnosing a
simple PATH lookup problem. But, I'm stumped also. I don't know of any
reason why you would be seeing this behavior if you are invoking python
in a consistent way.

> 
> Umm, have you rebooted? Probably an obvious step but I don't
> think environment vars get reset in real time. They didn't used
> to on NT but that may have changed in W2K or XP... I haven't
> checked in a while.

I believe that this has changed somewhat, where the environment is read
at program startup. So the env is not refreshed until you close and
re-launch the program in question (in this case 'cmd'). Not sure how
windows explorer is effected, which may require a logoff/logon.  But,
again I don't have a windows machine available to confirm, so take that
for what it's worth. It's not going to hurt to reboot, that's for certain.

> 
> Othewise I'm as stumped as you.
> 
> Alan G 



More information about the Tutor mailing list