[Python-Dev] 3.2.1 encoding surprise
Vinay Sajip
vinay_sajip at yahoo.co.uk
Wed Jul 20 16:19:08 CEST 2011
Glenn Linderman <v+python <at> g.nevcal.com> writes:
> Since I don't yet have associations set up that point at the
> launcher, I thought I'd play with saying "py" in front of the
> command.
Why don't you have any associations pointing to the launcher? Did you delete
them? If you uninstall and install the launcher, are they present?
> 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,
It's not py's job to walk the path: the shell does that when you just type
"foo". It locates foo.py, and then invokes py because of file association - py
then checks the file for a shebang to decide which Python to dispatch it to.
> 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
I'm afraid I can't reproduce this. When I invoke a script with the default
py.ini, py runs it with Python 2. When I add a [defaults]python=3 entry, py
correctly runs it with Python 3.
> is wrong? And why is the spacing around the = in the [commands]
> section so inconsistent?
That's just test data, not a real "production" py.ini. I was testing out
something, which is why the spaces around = are every which way, and I never got
around to changing it. More importantly, those customised commands, while
perhaps useful for testing, are useless in everyday Python usage: perhaps -O,
-Werror, -E, -S etc. might be more useful. I'll take suggestions as to what
might be useful customised commands to ship as a default.
Regards,
Vinay Sajip
More information about the Python-Dev
mailing list