#48 unknown encoding error in service .exe


When starting my service.exe I get errors like:
exceptions.LookupError: unknown encoding: iso-8859-1

I use string methods to encode/decode strings, eg
"hallo Günther".encode("iso-8859-1")

Including the modules encodings,encodings.idna,codecs
with --include did not help. It seems the default
encodings are not registered when python starts in the
py2exe framework.


  • Nobody/Anonymous

    Logged In: NO

    I have just seen a related problem when using py2exe to
    compile my XML utility.

    File "xml\parsers\xmlproc\xmlutils.pyc", line 43, in ?

    makes the call

    BOM = unicode("\xfe\xff","utf-16-be")

    which gives the error when running under py2exe:

    LookupError: unknown encoding: utf-16-be

    comment by: nrshapiro@msn.com

  • Nobody/Anonymous

    Logged In: NO

    I recently ran into a similar problem. The same exception is
    raised for both window and console styles applications.
    This can be verified using the following test console program

    #!/usr/bin/env python
    import sys
    import codecs
    if __name__ == '__main__':
    a_stream_writer = codecs.lookup('utf-8')[3]
    out = a_stream_writer(sys.stdout)
    out.write('Hello World!\n')

    and associated setup module:

    from distutils.core import setup
    import py2exe

    Using ActivePython 2.3 and py2exe 0.5.4, this test generates the
    following trace log:

    Traceback (most recent call last):
    File "py2exeEncodingTest.py", line 5, in ?
    a_stream_writer = codecs.lookup('utf-8')[3]
    LookupError: unknown encoding: utf-8

    Comment by: "-christian-.-baribeau-@-amirix-.-com-" (remove
    the '-')

  • Thomas Heller

    Thomas Heller - 2005-04-28

    Logged In: YES

    This is the most frequently asked question about py2exe,
    although I would not classify it as a bug. Googling for
    'EncodingsAgain' should find you a wiki page which explains
    and helps to solve this problem.

    Having said that, the next version will automatically
    include codecs and encodings, so it will (hopefully) be
    solved in the near future.

  • Thomas Heller

    Thomas Heller - 2005-05-11
    • status: open --> closed-later

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks