[issue20042] Python Launcher, Windows, fails on scripts w/ non-latin names

2017-07-05 Thread Konstantin Zemlyak

Konstantin Zemlyak added the comment:

Terry J. Reedy wrote:

> Is this still relevant or should it be closed?

Should be closed.

> On Win10, I created a short script юникод.py using Save As from IDLE.
>
> py -2 юникод.py produces
> C:\Programs\Python27\python.exe: can't open file '??.py': [Errno 22] 
> Invalid argument
> If the patch fixes 2.7 and looks okay, maybe we should apply. If 'no' or 
> 'no', maybe we should forget 2.7 running files with such names.

This outcome is expected and error comes from python itself, not from launcher.

> On 3.5 and 3.6, the file runs without issue.  The issue was opened with 3.3; 
> 3.5 switched to a much more recent compiler, and I did not see any indication 
> in the messages that this was tested on 3.5 before it was added.  So perhaps 
> for 3.5+, this is out-of-date.

Launcher works fine now from my testing.

--

___
Python tracker 
<http://bugs.python.org/issue20042>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16340] Error: 'utf-8' codec can't decode byte 0x9e in position 0: invalid start byte

2012-10-27 Thread Konstantin Zemlyak

New submission from Konstantin Zemlyak:

When installing python 3.3 under windows and checking "Compile .py files to 
byte code after installation" Lib/venv/scripts/nt/pydoc.py gets precompiled as 
well. This causes venv module to abort with "Error: 'utf-8' codec can't decode 
byte 0x9e in position 0: invalid start byte" while copying scripts from 
Lib/venv/scripts/nt since only .exe files are copied verbatim, and rest are 
treated as utf-8 text: 
http://hg.python.org/cpython/file/b20e473157b8/Lib/venv/__init__.py#l314

The solution is to add another exception to compileargs at Tools/msi/msi.py: 
http://hg.python.org/cpython/file/b20e473157b8/Tools/msi/msi.py#l419

This issue doesn't affect non-windows systems, since Lib/venv/scripts/posix 
doesn't contain .py files.

--
components: Installation
messages: 173955
nosy: zart
priority: normal
severity: normal
status: open
title: Error: 'utf-8' codec can't decode byte 0x9e in position 0: invalid start 
byte
type: behavior
versions: Python 3.3

___
Python tracker 
<http://bugs.python.org/issue16340>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16340] Decoding error in venv when byte-compiling stdlib

2012-10-27 Thread Konstantin Zemlyak

Konstantin Zemlyak added the comment:

If option to precompile python files is checked in installer, pydoc.py gets 
compiled into binary files Lib\venv\scripts\nt\__pycache__\pydoc.cpython33.pyc 
and Lib\venv\scripts\nt\__pycache__\pydoc.cpython33.pyo.

--

___
Python tracker 
<http://bugs.python.org/issue16340>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16340] Decoding error in venv when byte-compiling stdlib

2012-10-27 Thread Konstantin Zemlyak

Konstantin Zemlyak added the comment:

Also current title is a bit wrong, since decoding error happens in runtime each 
time venv is invoked, while the source of the problem happens while 
byte-compiling stdlib at install time once.

--

___
Python tracker 
<http://bugs.python.org/issue16340>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16340] Decoding error at install time when byte-compiling venv scripts

2012-10-27 Thread Konstantin Zemlyak

Konstantin Zemlyak added the comment:

Not at all. I have installed Python into "C:\Program Files (x86)\Python33". 
Also made a copy into "D:\Python33" and got the same results.

The problem is in file contents (pyc/pyo files are binary, utf-8 fails to 
decode them), not in filenames.

--

___
Python tracker 
<http://bugs.python.org/issue16340>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16340] Decoding error due to byte-compiling venv scripts at install time

2012-10-28 Thread Konstantin Zemlyak

Changes by Konstantin Zemlyak :


--
title: Decoding error at install time when byte-compiling venv scripts -> 
Decoding error due to byte-compiling venv scripts at install time

___
Python tracker 
<http://bugs.python.org/issue16340>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21177] ValueError: byte must be in range(0, 256)

2014-04-08 Thread Konstantin Zemlyak

New submission from Konstantin Zemlyak:

Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> bytearray([256])
Traceback (most recent call last):
  File "", line 1, in 
ValueError: byte must be in range(0, 256)
>>> bytes([256])
Traceback (most recent call last):
  File "", line 1, in 
ValueError: bytes must be in range(0, 256)
>>> 


Tested on 2.7, 3.2, 3.3, 3.4. Frankly, this looks like an off-by-one error to 
me.

--
components: Interpreter Core
messages: 215744
nosy: zart
priority: normal
severity: normal
status: open
title: ValueError: byte must be in range(0, 256)
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 
<http://bugs.python.org/issue21177>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21177] ValueError: byte must be in range(0, 256)

2014-04-10 Thread Konstantin Zemlyak

Konstantin Zemlyak added the comment:

To clarify few things:

- Yes, I know that 256 doesn't fit into byte. I was checking how 
bytes/bytearray are handling overflow.
- I know that range() is a half-open interval.

Yet this error message still gave me a "wtf" moment because I didn't realize it 
was talking about python's range() builtin and not about mathematical term. So 
even though this message is technically 100% correct it still doesn't feel 
right.

May I propose a message "byte must be in range [0-255]" instead? This won't be 
confused with either python's range() nor [] list notation.

--

___
Python tracker 
<http://bugs.python.org/issue21177>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2013-12-21 Thread Konstantin Zemlyak

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 
<http://bugs.python.org/issue20042>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2013-12-21 Thread Konstantin Zemlyak

Changes by Konstantin Zemlyak :


Removed file: 
http://bugs.python.org/file33247/pylauncher-fix-launcing-unicode-filenames.patch

___
Python tracker 
<http://bugs.python.org/issue20042>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2013-12-21 Thread Konstantin Zemlyak

Konstantin Zemlyak added the comment:

Sorry, fixed whitespaces in the patch.

--
Added file: 
http://bugs.python.org/file33248/pylauncher-fix-launcing-unicode-filenames.patch

___
Python tracker 
<http://bugs.python.org/issue20042>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2013-12-21 Thread Konstantin Zemlyak

Konstantin Zemlyak added the comment:

I don't care much about debug output though it probably should be fixed.

The point is that changing text mode of stdout has a weird side effect of 
fixing command-line arguments when invoking interactively from cmd.exe.

--

___
Python tracker 
<http://bugs.python.org/issue20042>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2013-12-21 Thread Konstantin Zemlyak

Konstantin Zemlyak added the comment:

There is something weird with my proposed fix. Right after submitting a bug 
with patch I've updated pythons on my system - 2.7.5 to 2.7.6, 3.3.2 to 3.3.3, 
and installed 3.4.0b1 - both 32- and 64-bit. Then my fixed py.exe stopped 
working.

Then I've added _setmode for stdin/stdout/stderr and rebuilt both debug/release 
and x86/x64 versions:

E:\>set PYLAUNCH_DEBUG=1

E:\>e:\cpython\PCbuild\py.exe юникод.py
launcher build: 32bit
launcher executable: Console
launcher charset: Multi-byte
File 'C:\Users\Zart\AppData\Local\py.ini' non-existent
File 'e:\cpython\PCbuild\py.ini' non-existent
Called with command line: .py
maybe_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: 
Синтаксическая ошибка в имени файла, имени папки или метке тома.
locate_pythons_for_key: "C:\Program Files\Python34\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: Синтаксическая ошибка в имени файла, 
имени папки или метке тома.
locate_pythons_for_key: "C:\Program Files (x86)\Python34\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.3-32' in environment
search for Python version '3.3-32' found '"C:\Program Files 
(x86)\Python33\python.exe"'
run_child: about to run '"C:\Program Files (x86)\Python33\python.exe" .py'
C:\Program Files (x86)\Python33\python.exe: can't open file '.py': [Errno 2] No 
such file or directory
child process exit code: 2

E:\>e:\cpython\PCbuild\py_d.exe юникод.py
launcher build: 32bit
launcher executable: Console
launcher charset: Multi-byte
File 'C:\Users\Zart\AppData\Local\py.ini' non-existent
File 'e:\cpython\PCbuild\py.ini' non-existent
Called with command line: юникод.py
maybe_handle_shebang: read 211 bytes
maybe_handle_shebang: BOM not found, using UTF-8
parse_shebang: found command: pyt

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

2013-12-21 Thread Konstantin Zemlyak

Konstantin Zemlyak added the comment:

Some more fun stuff with command-line (I'm cutting output to few essential 
lines for easier reading):


e:\cpython\PCbuild\py.exe юникод.py
...
Called with command line: .py
run_child: about to run '"C:\Program Files (x86)\Python33\python.exe" .py'
C:\Program Files (x86)\Python33\python.exe: can't open file '.py': [Errno 2] No 
such file or directory
child process exit code: 2

e:\cpython\PCbuild\py.exe e:\юникод.py
...
Called with command line: e:\юникод.py
run_child: about to run '"C:\Program Files (x86)\Python33\python.exe" 
e:\юникод.py'
child process exit code: 0


E:\>e:\cpython\PCbuild\py.exe тест\unicode.py
...
Called with command line: ест\unicode.py
run_child: about to run '"C:\Program Files (x86)\Python33\python.exe" 
ест\unicode.py'
C:\Program Files (x86)\Python33\python.exe: can't open file '': [Errno 2] No such file or directory
child process exit code: 2

E:\>e:\cpython\PCbuild\py.exe e:\тест\unicode.py
...
Called with command line: e:\тест\unicode.py
run_child: about to run '"C:\Program Files (x86)\Python33\python.exe" 
e:\тест\unicode.py'
child process exit code: 0


E:\>e:\cpython\PCbuild\py.exe "юникод.py"
Called with command line: "юникод.py"
run_child: about to run '"C:\Program Files (x86)\Python33\python.exe" 
"юникод.py"'
child process exit code: 0




IOW, so long as command-line starts with ASCII character everything is fine. If 
not, then one or more characters gets mangled. Now I'm not sure whether it's a 
cmd.exe bug or C runtime one, and whether it's possible to workaround about it.

--

___
Python tracker 
<http://bugs.python.org/issue20042>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8854] msvc9compiler.py: find_vcvarsall() doesn't work with VS2008 on Windows x64

2010-06-21 Thread Konstantin Zemlyak

Konstantin Zemlyak  added the comment:

Win2003 x64, VS2008, vanilla python 2.7rc1 amd64 from python.org.
Building python packages with C extensions works fine. Tested on simplejson, 
jinja2 (with enabled speedups) and PIL.

--
nosy: +zart

___
Python tracker 
<http://bugs.python.org/issue8854>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8854] msvc9compiler.py: find_vcvarsall() doesn't work with VS2008 on Windows x64

2010-06-21 Thread Konstantin Zemlyak

Konstantin Zemlyak  added the comment:

64-bit Windows, 64-bit cmd.exe, 64-bit python, not patched::

D:\>"c:\Program Files\Python27\python.exe"
Python 2.7rc1 (r27rc1:81787, Jun  6 2010, 20:03:36) [MSC v.1500 64 bit 
(AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import distutils.msvc9compiler
>>> distutils.msvc9compiler.get_build_version()
9.0
>>> distutils.msvc9compiler.find_vcvarsall(9.0)
'c:\\Program Files (x86)\\Microsoft Visual Studio 
9.0\\VC\\vcvarsall.bat'
>>>

How did you test? Maybe it's some difference in setup.

--

___
Python tracker 
<http://bugs.python.org/issue8854>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8854] msvc9compiler.py: find_vcvarsall() doesn't work with VS2008 on Windows x64

2010-06-21 Thread Konstantin Zemlyak

Konstantin Zemlyak  added the comment:

Tried msvc9compiler-py27.patch. find_vcvarsall() still works with the same 
result, while distutils.msvc9compiler.VS_BASE has been changed.

:: 
>>> distutils.msvc9compiler.find_vcvarsall(9.0)
u'c:\\Program Files (x86)\\Microsoft Visual Studio 
9.0\\VC\\vcvarsall.bat'
>>> distutils.msvc9compiler.VS_BASE
'Software\\Wow6432Node\\Microsoft\\VisualStudio\\%0.1f'

Checked registry, 9.0 is only under Wow6432Node.

--

___
Python tracker 
<http://bugs.python.org/issue8854>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8854] msvc9compiler.py: find_vcvarsall() doesn't work with VS2008 on Windows x64

2010-06-21 Thread Konstantin Zemlyak

Konstantin Zemlyak  added the comment:

> Using the remote shell, those VS2008 env vars are not set and
> so the build fails.

Seems it doesn't load user profile.

> The output is:
> 
> VS2008 product dir: None - Software\Microsoft\VisualStudio\9.0
> VS2008 product dir: None - Software\Microsoft\VCExpress\9.0

Same for me. Your patch fixes registry lookup.

--

___
Python tracker 
<http://bugs.python.org/issue8854>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9320] os.environ is global for threads

2010-07-21 Thread Konstantin Zemlyak

Konstantin Zemlyak  added the comment:

Environment variables have always been process-wide. It doesn't deserve any 
special mention in threads documentation.

--
nosy: +zart

___
Python tracker 
<http://bugs.python.org/issue9320>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com