[py2exe.i18n] English works, German works, but not French. What do I miss?

F. GEIGER franz.geiger at fh-vorarlberg.ac.at
Fri Aug 6 09:52:35 CEST 2004

"Harald Massa" <cpl.19.ghum at spamgourmet.com> wrote in message
news:Xns953D5E610BA51cpl19ghumspamgourmet at
> "F. GEIGER" <f.geiger at vol.at> wrote in news:cev7g9$3fm$1 at newshispeed.ch:
> > When I start a py2exe-ed application I get the error
> >
> > 'ascii' codec can't encode character u'\xe9' in position 10: ordinal
> > not in range(128)
> encodings: prepare to spend the night.
> First reading:
> http://starship.python.net/crew/theller/moin.cgi/EncodingsAgain
> Second:
> your error msg says that you are trying to encode sth. NOT ASCII to
> ASCII...
> I guess:
> your lokale site has another encoding configured
> import sys
> sys.getdefaultencoding()
> -- returns sth. like Latin-1
> And the py2exed application does not read siteconfig.py, and so in the
> running app sys.getdefaultencoding() would be some thing different.
> My approach to this is:
> in the beginning of the app I write:
> import sys
> if hasattr(sys,"setdefaultencoding"):
>     sys.setdefaultencoding("latin-1")

if hasattr() returns False, that means that site.py / sitecustomize.py has
been exec'ed and has deleted the attr 'setdefaultencoding', right?


import sys
if hasattr(sys,"setdefaultencoding"):
   pass # site.py did it already for us and everything should work

> so ... when no site-config was run, I manually set my default encoding to
> latin-1
> works great (together with what I described within the wiki)

Thank you, Harald, as I am traveling right now, I'll be able to try this in
the afternoon.

> Harald

Kind regards

More information about the Python-list mailing list