UnicodeEncodeError: 'ascii' codec can't encode character u'\xb7' in position 13: ordinal not in range(128)

akhil1988 akhilanger at gmail.com
Thu Jul 16 15:41:40 EDT 2009

I got the indentation errors fixed. Bu I get another error:

Traceback (most recent call last):
  File "./temp.py", line 484, in <module>
  File "./temp.py", line 476, in main
AttributeError: 'str' object has no attribute 'decode'

I am using Python3.1


akhil1988 wrote:
> Hi,
> Thanks all for the replies.
> I am working on a cluster of 15 nodes and I have now installed python 3.1
> on all of them. I tried installing python2.6 but there was some make
> error. So, I do not want to give more time in installing 2.4  and rather
> use 3.1 but for that I need to convert my 2.4 code to 3.1. 
> I used 2to3 tool, and it did make many changes in the 2.4 code, but still
> there are some indentation errors that I am unable to resolve being new to
> python. I have attached my python code, can anyone please fix the
> indentation error in the code. I am using vi editor.
> --Thanks a lot,
> Akhil http://www.nabble.com/file/p24522412/temp.py temp.py 
> alex23 wrote:
>> On Jul 16, 9:00 pm, akhil1988 <akhilan... at gmail.com> wrote:
>>> I have switched to python 3.1 , but now I am getting some syntax errors
>>> in
>>> the code:
>> Python 3.x was a major release that endeavoured to clean up a number
>> of lingering issues with the language, the upshot being that it isn't
>> entirely backwards compatible with past versions. Unicode became the
>> default string type, which is what is causing the error here: the u-
>> prefix is no longer required (or even allowed).
>> However, Py3.x _does_ come with a handy tool for automatically
>> converting Python 2.x code to 3.x, called 2to3. One of the things it
>> should do is convert Py2.x unicode values into their correct
>> representation in 3.x.
>> With any luck, it should be able to convert the code you're using
>> entirely. Let us know how it goes.
>> -- 
>> http://mail.python.org/mailman/listinfo/python-list

View this message in context: http://www.nabble.com/UnicodeEncodeError%3A-%27ascii%27-codec-can%27t-encode-character-u%27%5Cxb7%27-in-position-13%3A-ordinal-not-in-range%28128%29-tp24509879p24523113.html
Sent from the Python - python-list mailing list archive at Nabble.com.

More information about the Python-list mailing list