Message78286
Attempting to directly execute a script containing non-ASCII
characters in its name or path raises SyntaxError.
The script contents are mostly irrelevant, except it must contain an
encoding declaration (with *any* encoding, real or inexistent).
Running "python foo.py" works, but invoking it directly as "foo.py"
raises `SyntaxError: None`, or sometimes `SyntaxError: encoding
problem: with BOM` (no BOM is present in the source file, a plain
ASCII text file).
C:\TEMP>cd áéíóú
C:\TEMP\áéíóú>type test.py
# -*- coding: ascii -*-
C:\TEMP\áéíóú>C:\Apps\Python30\python.exe test.py
C:\TEMP\áéíóú>test.py
SyntaxError: None
To avoid any doubt, the file has no strange characters:
C:\TEMP\áéíóú>python -c "print(repr(open('test.py','rb').read()))"
'# -*- coding: ascii -*-\r\n'
and .py files are associated with the same interpreter:
C:\TEMP\áéíóú>assoc .py
.py=Python.File
C:\TEMP\áéíóú>ftype Python.File
Python.File="C:\Apps\Python30\python.exe" "%1" %*
The same thing happens if the file name contains any non-ASCII
character (the path may be pure ASCII). |
|
Date |
User |
Action |
Args |
2008-12-26 00:41:48 | ggenellina | set | recipients:
+ ggenellina |
2008-12-26 00:41:47 | ggenellina | set | messageid: <1230252107.45.0.57470787699.issue4747@psf.upfronthosting.co.za> |
2008-12-26 00:41:46 | ggenellina | link | issue4747 messages |
2008-12-26 00:41:45 | ggenellina | create | |
|