[issue20042] Python Launcher for Windows fails to invoke scripts with non-latin names

Konstantin Zemlyak report at bugs.python.org
Sat Dec 21 15:10:03 CET 2013


New submission from Konstantin Zemlyak:

Running `py.exe юникод.py` in cmd window fails:

E:\>set PYLAUNCH_DEBUG=1

E:\>py юникод.py
launcher build: 32bit
launcher executable: Console
File 'C:\Users\Zart\AppData\Local\py.ini' non-existent
Using global configuration file 'C:\Windows\py.ini'
Called with command line: .pymaybe_handle_shebang: read 211 bytes
maybe_handle_shebang: BOM not found, using UTF-8
parse_shebang: found command: python3
locating Pythons in 64bit registry
locate_pythons_for_key: unable to open PythonCore key in HKCU
locate_pythons_for_key: "C:\Program Files\Python27\python.exe" is a 64bit executable
locate_pythons_for_key: "C:\Program Files\Python2\PCBuild\python.exe: ?????????????? ?????? ? ????? ?????, ????? ????? ??? ????? ????.
locate_pythons_for_key: "C:\Program Files\Python2\PCBuild\amd64\python.exe: ?????????????? ?????? ? ????? ?????, ????? ????? ??? ????? ????.
locate_pythons_for_key: "C:\Program Files\Python32\python.exe" is a 64bit executable
locate_pythons_for_key: "C:\Program Files\Python3\PCBuild\python.exe: ?????????????? ?????? ? ????? ?????, ????? ????? ??? ????? ????.
locate_pythons_for_key: "C:\Program Files\Python3\PCBuild\amd64\python.exe: ?????????????? ?????? ? ????? ?????, ????? ????? ??? ????? ????.
locate_pythons_for_key: "C:\Program Files\Python33\python.exe" is a 64bit executable
locate_pythons_for_key: "C:\Program Files\Python3\PCBuild\python.exe: ?????????????? ?????? ? ????? ?????, ????? ????? ??? ????? ????.
locate_pythons_for_key: "C:\Program Files\Python3\PCBuild\amd64\python.exe: ?????????????? ?????? ? ????? ?????, ????? ????? ??? ????? ????.
locating Pythons in native registry
locate_pythons_for_key: unable to open PythonCore key in HKCU
locate_pythons_for_key: "C:\Program Files (x86)\Python27\python.exe" is a 32bit executable
locate_pythons_for_key: "C:\Program Files (x86)\Python2\PCBuild\python.exe: ?????????????? ?????? ? ????? ?????, ????? ????? ??? ????? ????.
locate_pythons_for_key: "C:\Program Files (x86)\Python2\PCBuild\amd64\python.exe: ?????????????? ?????? ? ????? ?????, ????? ????? ??? ????? ????.
locate_pythons_for_key: "C:\Program Files (x86)\Python32\python.exe" is a 32bit executable
locate_pythons_for_key: "C:\Program Files (x86)\Python3\PCBuild\python.exe: ?????????????? ?????? ? ????? ?????, ????? ????? ??? ????? ????.
locate_pythons_for_key: "C:\Program Files (x86)\Python3\PCBuild\amd64\python.exe: ?????????????? ?????? ? ????? ?????, ????? ????? ??? ????? ????.
locate_pythons_for_key: "C:\Program Files (x86)\Python33\python.exe" is a 32bit executable
locate_pythons_for_key: "C:\Program Files (x86)\Python3\PCBuild\python.exe: ?????????????? ?????? ? ????? ?????, ????? ????? ??? ????? ????.
locate_pythons_for_key: "C:\Program Files (x86)\Python3\PCBuild\amd64\python.exe: ?????????????? ?????? ? ????? ?????, ????? ????? ??? ????? ????.
found configured value 'python3=3.2-32' in environment
search for Python version '3.2-32' found '"C:\Program Files (x86)\Python32\python.exe"'
run_child: about to run '"C:\Program Files (x86)\Python32\python.exe" .py'
C:\Program Files (x86)\Python32\python.exe: can't open file '.py': [Errno 2] No such file or directory
child process exit code: 2


Note "Called with command line: .py" in output shows that filename was mangled very early on. Invoking `юникод.py` (which is associated with py.exe) directly works fine though.

The problem lies in Windows handling of command-line arguments and fix to this is simple but non-obvious. Patch attached.

----------
components: Unicode, Windows
files: pylauncher-fix-launcing-unicode-filenames.patch
keywords: patch
messages: 206741
nosy: ezio.melotti, haypo, zart
priority: normal
severity: normal
status: open
title: Python Launcher for Windows fails to invoke scripts with non-latin names
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file33247/pylauncher-fix-launcing-unicode-filenames.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20042>
_______________________________________


More information about the Python-bugs-list mailing list