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 lemburg
Recipients lemburg, sjmachin, tarek
Date 2008-12-30.12:41:35
SpamBayes Score 5.3774665e-09
Marked as misclassified No
Message-id <495A16FE.1030001@egenix.com>
In-reply-to <1230639630.73.0.892442560505.issue4742@psf.upfronthosting.co.za>
Content
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.
History
Date User Action Args
2008-12-30 12:41:37lemburgsetrecipients: + lemburg, sjmachin, tarek
2008-12-30 12:41:35lemburglinkissue4742 messages
2008-12-30 12:41:35lemburgcreate