[Python-Dev] 3.2.1 encoding surprise

Glenn Linderman v+python at g.nevcal.com
Fri Jul 22 01:02:46 CEST 2011


On 7/20/2011 5:11 PM, Mark Hammond wrote:
> It may be that your copy of the launcher is a little old - some 
> changes were pushed just yesterday (but I'm not sure if Vinay made a 
> new installer yet).  It has slightly better debug output (although 
> generally not what you are asking for yet) and better 
> "cross-bittedness" support. 

Installed new version:

msiexec /i launchwin.amd64.msi ALLUSERS=1

Expected behaviors of registry changes occurred.  Still launches python 
2, though, whereas c:\windows\py.ini contains:

[defaults]
python=3

[commands]
/usr/bin/perl=C:\perl\bin\perl.exe


Here is the debug output.  Seems like it isn't recognizing the python=3, 
even the new version.

d:\path\to\data>>set PYLAUNCH_DEBUG=1
set PYLAUNCH_DEBUG=1

d:\path\to\data>foo.py --pyver --clean
foo.py --pyver --clean
launcher build: 64bit
launcher executable: Console
File 'C:\Users\Glenn\AppData\Roaming\py.ini' non-existent
Using global configuration file 'C:\Windows\py.ini'
maybe_handle_shebang: read 256 bytes
maybe_handle_shebang: BOM not found, using UTF-8
locating Pythons in 32bit registry
locate_pythons_for_key: unable to open PythonCore key in HKCU
locate_pythons_for_key: C:\Python26\python.exe is a 32bit executable
locate_pythons_for_key: C:\Python26\PCBuild\python.exe: The system 
cannot find the path specified.
locate_pythons_for_key: C:\Python26\PCBuild\amd64\python.exe: The system 
cannot find the path specified.
locate_pythons_for_key: C:\Python31\python.exe is a 32bit executable
locate_pythons_for_key: C:\Python31\PCBuild\python.exe: The system 
cannot find the path specified.
locate_pythons_for_key: C:\Python31\PCBuild\amd64\python.exe: The system 
cannot find the path specified.
locating Pythons in native registry
locate_pythons_for_key: unable to open PythonCore key in HKCU
locate_pythons_for_key: C:\Python32\python.exe is a 64bit executable
locate_pythons_for_key: C:\Python32\PCBuild\python.exe: The system 
cannot find the path specified.
locate_pythons_for_key: C:\Python32\PCBuild\amd64\python.exe: The system 
cannot find the path specified.
found no configured value for 'python'
search for default Python found version 2.6 at 'C:\Python26\python.exe'
run_child: about to run 'C:\Python26\python.exe "D:\my\py\foo.py"  
--pyver --clean'
   File "D:\my\py\foo.py", line 469
SyntaxError: Non-ASCII character '\xc3' in file D:\my\py\foo.py on line 
470, but no encoding declared; see 
http://www.python.org/peps/pep-0263.html for details
child process exit code: 1

d:\path\to\data>

So, looking at the code, get_configured_value produces that message, but 
there are 3 places to look for "python".  Setting the environment 
variable makes it work.  Eliminating the environment variable, I then 
copied c:\Windows\py.ini to c:\users\glenn\appdata\roaming\py.ini.  That 
worked.  So I guess the syntax of my py.ini file is correct.  But 
apparently it isn't properly using c:\windows\py.ini !!  Yet curiously, 
it reports the correct name for the global configuration file.

Aha!

Bad logic is get_configured_value!  get_configured_value only looks in 
the global configuration file if there is a local configuration file 
that doesn't have the setting.  It should look in the global 
configuration file if there is no local configuration file _OR_ the is a 
local configuration file without the setting.

I'll await a new launcher.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110721/2453cf6c/attachment-0001.html>


More information about the Python-Dev mailing list