encoding issue (cp720)

Lie Ryan lie.1296 at gmail.com
Wed May 12 06:14:53 EDT 2010


On 05/12/10 18:43, M. Bashir Al-Noimi wrote:
> Hi All,
> 
> I'm still a newbie in Python (I started learn it yesterday)  and I faced
> a huge problem cuz python always crashes because of encoding issue!
> 
>> Fatal Python error: Py_Initialize: can't initialize sys standard streams
>> LookupError: unknown encoding: cp720
> 
> so I filed a bug report
> <http://bugs.python.org/issue8693?@ok_message=msg%20105576%20created%3Cbr%3Eissue%208693%20message_count%2C%20messages%20edited%20ok&@template=item>
> about it but I couldn't find a solution for this problem so could you
> please help me to run python correctly?

This is partly a locale issue; your terminal (command prompt) is using a
locale yet unsupported by python. You can use 'chcp' to switch to
different terminal code page (e.g. use chcp 1250). You won't be able to
'print' arabic characters, but at least python should run.

> *Note:*
> 
>    * I'm using: Windows XP SP3 32Bit, Python 3.1.2
>    * I tried to copy cp720.py
>      <http://svn.python.org/view/python/trunk/Lib/encodings/cp720.py>
>      to Python31\Lib\encodings but it didn't fix the issue and gives me
>      an error message (see attachment plz)

You're using Python 3.1, the cp720.py file you copied is for Python 2.7
(trunk); there are some backward incompatible between python 2 and
python 3 (specifically in your case, unicode string is now default in
python 3, so unicode literal is no longer supported). Try using the
cp720.py from py3k branch:
http://svn.python.org/view/python/branches/py3k/Lib/encodings/cp720.py?view=markup



More information about the Python-list mailing list