Unicode error in exefied Python script

Christian Bretterklieber cb at orcl.net
Mon Jan 20 06:09:52 EST 2003


Martin v. L?wis <martin at v.loewis.de> wrote:

>>   The error message it throws is "UnicodeError: ASCII decoding error:
>> Ordinal not in range (128)". Interestingly enough, the script as is
>> works, just not the exefied version (The --packages encodings option to
>> py2exe was given, of course).

> Perhaps you have changed the system default encoding in site.py? You
> should not do this.

  I did, as I said in my first post. But I only did it after the error
occured the first time. And this was mentioned in some posts I found on
the Net. I think it's also mentioned in site.py in some comment. I
inserted the following:

if 1:
   sys.setdefaultencoding('iso-8859-1')



> If you haven't changed the system default encoding, you should find
> out why the script works when run with an installed Python. Inspect
> the line that causes the exception, and find out whether you are
> converting byte \x80 to a Unicode string. If this won't happen, you
> are just using different data in both cases.

  I will have a look into it. Nonetheless, the data is absolutely the
same in both cases. This is weird, indeed.

> Regards,
> Martin

cu,

c/hris.

-- 
"The proper way to handle HTML postings is to cancel the article, then
kill the poster, his wife and kids, and fuck his dog and smash his
computer into little bits. Anything more is just extremism."
                                 -- Paul Tomblin




More information about the Python-list mailing list