[Tutor] Weird Try..Except Error

Alan Gauld alan.gauld at btinternet.com
Fri Nov 25 22:11:17 CET 2011

On 25/11/11 12:42, Nikunj.Badjatya at emc.com wrote:

> I had Python27 and Python32 both installed togethar.
> In Windows the PATH env variable, I had set Python27 exe and lib path.
> But When I do
> C:\>  Python  [PressEnter]
> I get 2.7
> But when I run
> C:\>  script.py  [PressEnter]
> The script is running with Python3.2 ,
 > thts weird because I have set my Path variable with Pytho27 exe

This is one of the annoying ambiguities of Windows.
The way it finds the executable for  executables(exe, bat cmd etc) is 
different to how it finds the executable for associations.

In the former case it uses PATH, in the latter it relies on the file 
association set in the file properties.

When you install a new Python it  tends to set itself as
the default interpreter for .py files.


Alan G.

More information about the Tutor mailing list