SyntaxError: encoding problem: with BOM

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Dec 26 13:08:02 CET 2008


En Thu, 25 Dec 2008 11:55:16 -0200, NoName <zaz600 at gmail.com> escribió:

> Error
> ----
> C:\Documents and Settings\Ra\Рабочий стол>11.py
>   File "<decoding error>", line 1
> SyntaxError: encoding problem: with BOM
>
> No error
> ----
> C:\Documents and Settings\Ra\Рабочий стол>python 11.py
> test
>
> Error when russian symbols in full path to py-script.
> Is it Python bug? or i need to modify some registry keys?

Yes, it's a bug. The encoding declaration may be anything, ascii, even an
inexistent codec will trigger the bug. Any non-ascii character in the
script name or path provokes then a SyntaxError when the script is
executed directly.
As a workaround, avoid using any Russian characters in directory names or
script file names, or invoke them always using "python xxx.py", not
directly.

> OS: WinXP SP3 Russian.
> Python 3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit
> (Intel)] on win32

My tests were on WinXP SP3 Spanish.
See http://bugs.python.org/issue4747

-- 
Gabriel Genellina




More information about the Python-list mailing list