No encodings after freezing

"Martin v. Löwis" martin at v.loewis.de
Mon May 23 13:37:03 EDT 2005


mmf wrote:
> text_new = text.encode('utf_8')
[...]
> But everytime I run this binary the utf-8 encoding cannot be found.
> (Also any other encoding like iso8859_15 cannot be found...)
> 
> What am I doing wrong?

Codecs are modules (in the encodings package). So if the codecs
you need aren't frozen, they aren't available at run-time. OTOH,
freeze cannot "see" the import (since it doesn't know that the
argument to .encode is really similar to a module name), so
it won't include the modules. You need to give it an explicit
list of encodings you want to freeze.

Most likely, there is some explicit command line argument, but
alternatively, you could also put

if 0:
  import encodings.utf_8
  import encodings.iso8859_1
  # etc

into some source file.

Regards,
Martin



More information about the Python-list mailing list