Author ggenellina
Recipients ggenellina
Date 2008-12-26.00:41:45
SpamBayes Score 8.50206e-05
Marked as misclassified No
Message-id <>
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" works, but invoking it directly as "" 
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 áéíóú

# -*- coding: ascii -*-


SyntaxError: None

To avoid any doubt, the file has no strange characters:

C:\TEMP\áéíóú>python -c "print(repr(open('','rb').read()))"
'# -*- coding: ascii -*-\r\n'

and .py files are associated with the same interpreter:

C:\TEMP\áéíóú>assoc .py

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:48ggenellinasetrecipients: + ggenellina
2008-12-26 00:41:47ggenellinasetmessageid: <>
2008-12-26 00:41:46ggenellinalinkissue4747 messages
2008-12-26 00:41:45ggenellinacreate