utf encoding error

Discussion in 'Python' started by Timothy Smith, May 5, 2005.

  1. hi there, this one is in relation to my py2exe saga.

    when i compile a package using py2exe i get the error msg below, if i
    just run the py files it doesn't error, so i assume pysvn is trying to
    use something thats not being included in the build. only i have no idea
    where to start looking.

    Traceback (most recent call last):
    File "Main.pyc", line 819, in ValidateLogin
    File "Main.pyc", line 861, in ShowMainFrameItems
    LookupError: unknown encoding: utf-8


    and here is my setup.py for py2exe for good measure

    from distutils.core import setup
    import py2exe

    package_dir = ['c:\python23\reportlab', 'c:\python23\lib',
    'Z:\Projects\PubWare\trunk\python']

    setup(windows=[ "Z:\\Projects\\PubWare\\trunk\\python\\PubWare.py"])
    Timothy Smith, May 5, 2005
    #1
    1. Advertising

  2. Timothy Smith wrote:
    > hi there, this one is in relation to my py2exe saga.
    >
    > when i compile a package using py2exe i get the error msg below, if i
    > just run the py files it doesn't error, so i assume pysvn is trying to
    > use something thats not being included in the build. only i have no idea
    > where to start looking.
    >
    > Traceback (most recent call last):
    > File "Main.pyc", line 819, in ValidateLogin
    > File "Main.pyc", line 861, in ShowMainFrameItems
    > LookupError: unknown encoding: utf-8
    >
    >
    > and here is my setup.py for py2exe for good measure
    >
    > from distutils.core import setup
    > import py2exe
    > package_dir = ['c:\python23\reportlab', 'c:\python23\lib',
    > 'Z:\Projects\PubWare\trunk\python']
    > setup(windows=[
    > "Z:\\Projects\\PubWare\\trunk\\python\\PubWare.py"])



    Py2exe has a Wiki which answers a lot of these questions. In general,
    you might find it useful to look there.

    For your problem: you need to explicitly include the encodings module
    for utf8. Using static analysis Py2exe can't known to include it in the
    built exe. Something like this should work for you ...

    # setup.py

    from distutils.core import setup
    import py2exe

    explicitIncludes = [
    "encodings.utf_8",

    ]

    opts = {
    "py2exe": {
    "includes": explicitIncludes,
    # "optimize" : 2
    }
    }

    setup(
    windows = ["XXXXXX.py"],
    options=opts,
    )
    Mike Thompson, May 5, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page