[Python-Dev] 3.2.1 encoding surprise

Glenn Linderman v+python at g.nevcal.com
Thu Jul 21 02:02:04 CEST 2011


On 7/20/2011 4:41 PM, Mark Hammond wrote:
> On 21/07/2011 7:43 AM, Glenn Linderman wrote:
> ...
>>
>> I still get the same behavior.  Is there any debugging output produced
>> by py.exe that would tell what py.ini it looks in, and what the content
>> is?  What diagnostic steps might I take to produce additional
>> information that would help you (or me, along the way) analyze the
>> issue?  I do not presently have a C compiler installed on this machine,
>> however, unless it came along for a ride with something else.
>
> It doesn't do exactly what you ask, but setting an environment 
> variable PYLAUNCH_DEBUG to any value will cause some debug output to 
> be generated to stdout.
>
> Mark
>

It produces:

d:\>py d:\path\to\foo.py
launcher build: 64bit
launcher executable: Console
File 'C:\Users\Glenn\AppData\Roaming\py.ini' non-existent
maybe_handle_shebang: read 256 bytes
maybe_handle_shebang: BOM not found, using UTF-8
locate_pythons_for_key: unable to open PythonCore key
locate_pythons_for_key: unable to open PythonCore key
run_child: about to run 'C:\Python26\python.exe d:\path\to\foo.py'
   File "d:\path\to\foo.py", line 469
child process exit code: 1

So this tells me that it didn't find a local py.ini (no surprise, I 
don't have one) but doesn't tell me that it did find or read 
c:\Windows\system32\py.ini much less whether I have the syntax correct 
for my [defaults] section.  It doesn't tell me that it didn't find a #! 
line (but there isn't one).

Perhaps the problem is that there isn't one?  If it finds no virtual 
command, maybe it doesn't obey the [defaults] python=3 directive?  The 
PEP says it should act like '!#python' (I think the PEP meant 
'#!python', though????).  There is no " " after '!#python' in the PEP, 
so that disqualifies it from being a customized command, there is no 
'/usr/bin/' nor '/usr/bin/env ' in front of the 'python' so that means 
it is not a virtual command; and it is not a fully-qualified name, so it 
doesn't mean that case either.... looks like the PEP needs a bit of 
clarification here.

I do have a python on my path, but it is 3.1.2, not 3.2.1 or 2.6.4, and 
it runs 2.6.4 as the output shows.  And I would expect it to run 3.2.1 
with the [defaults] python=3 directive, since that is newer than 3.1.2, 
which is on my PATH.

So, still a mystery.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110720/3705e75e/attachment.html>


More information about the Python-Dev mailing list