Marc-Andre Lemburg <m...@egenix.com> added the comment:

On 2008-12-30 13:20, John Machin wrote:
> byte-compiling C:\python26\Lib\site-packages\x9d.py to x9d.pyc
> SyntaxError: ('unknown encoding: cp1252',
> ('C:\\python26\\Lib\\site-packages\\x9d.py', 0, 0, None))
> 
> byte-compiling c:\python25\Lib\site-packages\x9d.py to x9d.pyc
>   File "c:\python25\Lib\site-packages\x9d.py", line 0
> SyntaxError: ('unknown encoding: cp1252',
> ('c:\\python25\\Lib\\site-packages\\x9d.py', 0, 0, None))
> 
> Added file: http://bugs.python.org/file12492/x9d.py

FWIW, I've tried that file with Python 2.5 and 2.6 on my machine:

lemburg/tmp> python2.5 ~/bin/pycompile.py x9d.py
 compiling x9d.py -> x9d.pyc
   XXX <type 'exceptions.SyntaxError'>: unknown encoding: cp1252 (x9d.py, line 
0)

lemburg/tmp> python2.6 ~/bin/pycompile.py x9d.py
 compiling x9d.py -> x9d.pyc
   XXX <type 'exceptions.SyntaxError'>: unknown encoding: cp1252 (x9d.py, line 
0)

Note that the line number is wrong in both messages.

It is interesting that simply running the files gives a more correct
error message:

lemburg/tmp> python2.5 x9d.py
  File "x9d.py", line 2
SyntaxError: 'charmap' codec can't decode byte 0x9d in position 0: character
maps to <undefined>

lemburg/tmp> python2.6 x9d.py
  File "x9d.py", line 2
SyntaxError: 'charmap' codec can't decode byte 0x9d in position 0: character
maps to <undefined>

The character position is wrong again in both messages.

Needless to say that the encoding "cp1252" is *not* unknown. It looks
like compile() causes the decoding error to be overwritten with a
misleading error message.

----------
nosy: +lemburg

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4742>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to