[Python-Dev] 3.2.1 encoding surprise

Glenn Linderman v+python at g.nevcal.com
Mon Jul 18 22:36:48 CEST 2011


On 7/18/2011 1:01 PM, Paul Moore wrote:
> 2011/7/18 Glenn Linderman<v+python at g.nevcal.com>:
>> Attached reduced test case works fine with Python 3.1, fails with Python3.2:
> PS D:\Data>  py -3 .\t32enc.py
> PS D:\Data>  py -2 .\t32enc.py
>    File ".\t32enc.py", line 1
> SyntaxError: Non-ASCII character '\xc3' in file .\t32enc.py on line 1,
> but no encoding declared; see http://www.python.o
> rg/peps/pep-0263.html for details
> PS D:\Data>  py -3 --version
> Python 3.2.1
> PS D:\Data>  py -2 --version
> Python 2.7
>
> Windows 7 32-bit, py is Vinay's implementation of the PEP 397 launcher
> for Windows.
>
> This looks like correct output to me.
>
> Could it be your environment somehow?
> Paul.

Yes, a surprise.  But it is my environment.... I'm not sure exactly how 
or why yet.  I've continued investigating since posting that... but 
thanks for the confirmation that it isn't 3.2.1 !

Tweaked the program to show the version and it showed 2.6.4!  Which is 
the only version of Python 2.x installed here.

So my suspicion is that   launchsys.adm64.msi, installed just after 
3.2.1 (but which appeared to do nothing) has taken over ... something.  
Not sure what yet.

The reason I thought it did nothing, is that I checked assoc  ( 
=Python.File ) and ftype ( =c:\python32\python.exe "%1" %* ) both of 
which look familiar, and neither of which mention   py.exe  which is 
what I think the launcher is supposed to have been named; and running  
c:\python32\python.exe from the command line produces a Python that 
looks like 3.2.1 .

But somehow, running    t32enc.py  from the command line fails, and 
loads 2.6.4 !

 From what I've read about the launcher, I thought it was supposed to 
take over the assoc and ftype and point Python.File to  
c:\windows\system32\py.exe  -- but that hasn't happened (and yes, I've 
rebooted since doing the installs, so it is not just a leftover CMD that 
didn't pick up new values).

So my question now is: how does the launcher really get activated when 
invoking .py files from the command line, if the assoc and ftype 
indicate that it should run c:\python32\python.exe (which when I run by 
hand, seems to be what the name claims it to be)?

We don't need to create mysteries!

Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110718/f4ee2476/attachment.html>


More information about the Python-Dev mailing list