Unicode error in exefied Python script

Christian Bretterklieber cb at orcl.net
Tue Jan 21 05:10:06 EST 2003


Martin v. L?wis <martin at v.loewis.de> wrote:
> Christian Bretterklieber <cb at orcl.net> writes:

>>   I have now found the difference. When I execute the script,
>> sys.getdefaultencoding() returns 'cp1252'. 

> So you have edited site.py? You should also undo this edit.

  Yes. But not to 'cp1252'. See below.

>>   Is there another simple method to set the default encoding? 

> No. Instead, you should modify your script not to rely on the system
> default encoding.

  This sounds like a lot of work. I have data from various sources. And
does that mean if I set a simple string within my script, I also need to
call encode? Like:

  mystring = 'Suppi String äüß ...'.encode('latin1')

>> And what might be the cause for the exefied script to have a
>> different encoding?

> 'ascii' is the factory default for Python. So the question is why you
> don't get the factory default.

  PythonWin interactive shell: 'iso-8859-1' (which I set in site.py)
  Script: 'cp1252' (no idea where this comes from)
  EXE version: 'ascii'

> Regards,
> Martin


c/hris.

-- 
Love is Hate. War is Peace. Windows is stable.




More information about the Python-list mailing list