This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ggenellina
Recipients ggenellina
Date 2008-12-26.00:41:45
SpamBayes Score 8.5020605e-05
Marked as misclassified No
Message-id <1230252107.45.0.57470787699.issue4747@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2008-12-26 00:41:48ggenellinasetrecipients: + ggenellina
2008-12-26 00:41:47ggenellinasetmessageid: <1230252107.45.0.57470787699.issue4747@psf.upfronthosting.co.za>
2008-12-26 00:41:46ggenellinalinkissue4747 messages
2008-12-26 00:41:45ggenellinacreate