[Tutor] Wrong version of Python being executed

Alan Gauld alan.gauld at btinternet.com
Mon Nov 12 01:16:35 CET 2007


"Martin Walsh" <mwalsh at groktech.org> wrote

>>>> Try using the full path to python, just to be sure: 
>>>> c:\python25\python
>>>> script.py -- do you get the same behavior?
>> This works just fine- I would expect it to.
>
> Actually, I would have expected the opposite.

Me too.

> Though this still doesn't explain why you get python2.5 
> interactively,
> and python2.3 when running a script -- perhaps I'm still unclear 
> what
> you are seeing. Would the following be an accurate description of 
> the
> behavior?
>
> assuming:
> - 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

This is very important. If you just type python at the Run
dialog it uses a different algorithm to find the exe than if
you type python at a DOS prompt inside a CMD window.
Its the second algorithm that is used if you type
python foo.py at a cmd prompt but the first that
is used if you double click foo.py within explorer
(actually that could even be a different one again!)
or type python foo.py in the Run dialog.

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

That *shouldn't* make any difference...but you can never be 100% sure!


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list