So I have a command foo.py using Python 3 syntax in a directory on
my PATH. It works fine, since Python 3.2.1 is in Python.file.
foo.py does not have a #! line.
I can successfully execute: foo.py
However, the following fails: py foo.py
It fails, because foo.py is not found. Instead, I have to specify:
py d:\path\to\foo.py
This is annoying, py should walk the PATH for unqualified files (the
Windows PATH implicitly includes the current directory, of course,
but if it were in the current directory, it would just work).
So when I: type c:\windows\system32\py.ini
I get a set of h2 h3 v2 v3 commands in a section called [commands].
Not sure where my [defaults] went. Is there some more Windows magic
to be explained? WOW6432-ness, perhaps? Probably my editor is
running as a 32-bit process, so looked in the wrong
C:\windows\system32 !!
OK, with that mystery solved, and using Notepad running as
administrator to actually, successfully edit the file, it still runs
the wrong version of Python. Here is the content of the file, what
is wrong? And why is the spacing around the = in the [commands]
section so inconsistent?
[defaults]
python=3
[commands]
h2=c:\Python26\python -h
h3 = c:\Python32\python -h
v2= c:\Python26\python -V
v3 =c:\Python32\python -V
OK, so when I specify: py d:\path\to\foo.py
It fails, but this time it is because it launches Python 2.6.4. So
the [defaults] section doesn't seem to have an effect.