Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Monday, April 30, 2007

Python: unknown Encoding

I nearly pulled my hair out while trying to find the solution for this error:

LookupError: unknown encoding: cp720

FROM this following code fragment:

print "Name: ", objItem.Name

It was obvious, since my Windows System is an Arabic locale, with English default text, that I was surly to have some kind of problem.

I managed to find a lot of information regarding codecs, encoding, local, setlocale, etc. However, I managed to get it solved by using the str() function!

print "Name: ", str(objItem.Name)

Voi la..