LookupError: unknown encoding: idna question

I have a wxPython application that i can run no problem from source, When I use the cx_Freeze it compiled into an executable file after,
Traceback (most recent call last):
  File "searchOrder.py", line 88, in OnSearchButton

  File "/usr/lib/python2.4/httplib.py", line 810, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.4/httplib.py", line 827, in _send_request
    self.putrequest(method, url, **skips)

  File "/usr/lib/python2.4/httplib.py", line 760, in putrequest
    self.putheader('Host', "%s:%s" % (self.host.encode("idna"), self.port))
LookupError: unknown encoding: idna

def OnSearchButton(self, event):
        conn = httplib.HTTPConnection("[192.168.0.207:90](http://192.168.0.207:90)")
88 line url = "/backOffice/orders/search?start=0&limit=20&ordersId=ORD200808A201&externalRequest=PytonClient"

        conn.request("GET", url)
        response = conn.getresponse()
        #print response.status, response.reason
        data = response.read()
        conn.close()
        #print data[1:-1]

        obj = cjson.decode(data[1:-1])
        #print obj["results"][0]["ordersId"]
        frame = listOrder.create(self, obj)
        frame.Show()

Regards,

Any suggestions would be appreciated.

何帅 wrote:

I have a wxPython application that i can run no problem from source, When I use the cx_Freeze it compiled into an executable file after,
Traceback (most recent call last):
  File "searchOrder.py", line 88, in OnSearchButton

  File "/usr/lib/python2.4/httplib.py", line 810, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.4/httplib.py", line 827, in _send_request
    self.putrequest(method, url, **skips)

  File "/usr/lib/python2.4/httplib.py", line 760, in putrequest
    self.putheader('Host', "%s:%s" % (self.host.encode("idna"), self.port))
LookupError: unknown encoding: idna

With freeze utilities like py2exe and cx_freeze you sometimes have to
help it a bit in including all the files which are needed to run.

With py2exe one defines this in the packages option. Here is a post on
the cx_freeze list with a similar problem, it shows how to include a
particular encoding using include-modules, maybe there is also something
like an include-packages.

http://sourceforge.net/mailarchive/forum.php?thread_name=991ca2590701030133i1126f294u6f0a232f6d43ae73%40mail.gmail.com&forum_name=cx-freeze-users

Werner

Thank you so quickly back to me.

I try to use FreezePython --include-modules=encodings --install-dir dist backOffice.py, or in the same issue,

···

2008/8/18 Werner F. Bruhin werner.bruhin@free.fr

何帅 wrote:

I have a wxPython application that i can run no problem from source, When I use the cx_Freeze it compiled into an executable file after,

Traceback (most recent call last):

File “searchOrder.py”, line 88, in OnSearchButton

File “/usr/lib/python2.4/httplib.py”, line 810, in request

self._send_request(method, url, body, headers)

File “/usr/lib/python2.4/httplib.py”, line 827, in _send_request

self.putrequest(method, url, **skips)

File “/usr/lib/python2.4/httplib.py”, line 760, in putrequest

self.putheader('Host', "%s:%s" % (self.host.encode("idna"), self.port))

LookupError: unknown encoding: idna

With freeze utilities like py2exe and cx_freeze you sometimes have to

help it a bit in including all the files which are needed to run.

With py2exe one defines this in the packages option. Here is a post on

the cx_freeze list with a similar problem, it shows how to include a

particular encoding using include-modules, maybe there is also something

like an include-packages.

http://sourceforge.net/mailarchive/forum.php?thread_name=991ca2590701030133i1126f294u6f0a232f6d43ae73%40mail.gmail.com&forum_name=cx-freeze-users

Werner


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Hi,

Cole wrote:

Thank you so quickly back to me.
I try to use FreezePython --include-modules=encodings --install-dir
dist backOffice.py, or in the same issue,

I don't use cx_freeze so not sure, but from the post I would think it
should be:

--include-modules=encodings.idna --install-dir dist backOffice.py

or try to find if there is something like:
--include-packages=encodings --install-dir dist backOffice.py

Werner

···

2008/8/18 Werner F. Bruhin <werner.bruhin@free.fr
<mailto:werner.bruhin@free.fr>>

    何帅 wrote:
    > I have a wxPython application that i can run no problem from
    source, When I use the cx_Freeze it compiled into an executable
    file after,
    > Traceback (most recent call last):
    > File "searchOrder.py", line 88, in OnSearchButton
    >
    > File "/usr/lib/python2.4/httplib.py", line 810, in request
    > self._send_request(method, url, body, headers)
    > File "/usr/lib/python2.4/httplib.py", line 827, in _send_request
    > self.putrequest(method, url, **skips)
    >
    > File "/usr/lib/python2.4/httplib.py", line 760, in putrequest
    > self.putheader('Host', "%s:%s" % (self.host.encode("idna"),
    self.port))
    > LookupError: unknown encoding: idna
    >
    >
    With freeze utilities like py2exe and cx_freeze you sometimes have to
    help it a bit in including all the files which are needed to run.

    With py2exe one defines this in the packages option. Here is a post on
    the cx_freeze list with a similar problem, it shows how to include a
    particular encoding using include-modules, maybe there is also
    something
    like an include-packages.

    Thread: [cx-freeze-users] need encoding ? | cx_Freeze
    <Thread: [cx-freeze-users] need encoding ? | cx_Freeze;

    Werner
    _______________________________________________
    wxpython-users mailing list
    wxpython-users@lists.wxwidgets.org
    <mailto:wxpython-users@lists.wxwidgets.org>
    http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

------------------------------------------------------------------------

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

I was successful, very grateful.
I use import modules,
import encodings.ascii
import encodings.idna

[root@host193 cx_Freeze-3.0.3]# FreezePython --install-dir dist backOffice.py
Name File


m Frame1 Frame1.py
m StringIO /usr/lib/python2.4/StringIO.py
m UserDict /usr/lib/python2.4/UserDict.py
m builtin
m main backOffice.py
m _codecs
m _locale /usr/lib/python2.4/lib-dynload/_localemodule.so
m _random /usr/lib/python2.4/lib-dynload/_randommodule.so
m _socket /usr/lib/python2.4/lib-dynload/_socketmodule.so
m _sre
m ssl /usr/lib/python2.4/lib-dynload/ssl.so
m array /usr/lib/python2.4/lib-dynload/arraymodule.so
m base64 /usr/lib/python2.4/base64.py
m binascii /usr/lib/python2.4/lib-dynload/binascii.so
m cStringIO /usr/lib/python2.4/lib-dynload/cStringIO.so
m cjson /usr/lib/python2.4/site-packages/cjson.so
m codecs /usr/lib/python2.4/codecs.py
m copy /usr/lib/python2.4/copy.py
m copy_reg /usr/lib/python2.4/copy_reg.py
m cx_Freeze__init
/root/Desktop/cx_Freeze-3.0.3/initscripts/Console.py
m dis /usr/lib/python2.4/dis.py
m dummy_thread /usr/lib/python2.4/dummy_thread.py
P encodings /usr/lib/python2.4/encodings/init.py
m encodings.aliases /usr/lib/python2.4/encodings/aliases.py
m encodings.ascii /usr/lib/python2.4/encodings/ascii.py
**m encodings.idna /usr/lib/python2.4/encodings/idna.py ** --------------------- here
m errno

m exceptions
m fcntl /usr/lib/python2.4/lib-dynload/fcntlmodule.so
m getopt /usr/lib/python2.4/getopt.py
m httplib /usr/lib/python2.4/httplib.py

m imp
m inspect /usr/lib/python2.4/inspect.py
m itertools /usr/lib/python2.4/lib-dynload/itertoolsmodule.so
m linecache /usr/lib/python2.4/linecache.py

m listOrder listOrder.py
m locale /usr/lib/python2.4/locale.py
m macpath /usr/lib/python2.4/macpath.py
m math /usr/lib/python2.4/lib-dynload/mathmodule.so

m mimetools /usr/lib/python2.4/mimetools.py
m new /usr/lib/python2.4/new.py
m ntpath /usr/lib/python2.4/ntpath.py
m opcode /usr/lib/python2.4/opcode.py

m os /usr/lib/python2.4/os.py
m os2emxpath /usr/lib/python2.4/os2emxpath.py
m popen2 /usr/lib/python2.4/popen2.py
m posix
m posixpath /usr/lib/python2.4/posixpath.py

m pwd
m quopri /usr/lib/python2.4/quopri.py
m random /usr/lib/python2.4/random.py
m re /usr/lib/python2.4/re.py
m repr /usr/lib/python2.4/repr.py

m rfc822 /usr/lib/python2.4/rfc822.py
m searchOrder searchOrder.py
m signal
m socket /usr/lib/python2.4/socket.py
m sre /usr/lib/python2.4/sre.py

m sre_compile /usr/lib/python2.4/sre_compile.py
m sre_constants /usr/lib/python2.4/sre_constants.py
m sre_parse /usr/lib/python2.4/sre_parse.py
m stat /usr/lib/python2.4/stat.py

m string /usr/lib/python2.4/string.py
m stringprep /usr/lib/python2.4/stringprep.py
m strop /usr/lib/python2.4/lib-dynload/stropmodule.so
m struct /usr/lib/python2.4/lib-dynload/structmodule.so

m sys
m tempfile /usr/lib/python2.4/tempfile.py
m thread
m time /usr/lib/python2.4/lib-dynload/timemodule.so
m token /usr/lib/python2.4/token.py

m tokenize /usr/lib/python2.4/tokenize.py
m traceback /usr/lib/python2.4/traceback.py
m types /usr/lib/python2.4/types.py
m unicodedata /usr/lib/python2.4/lib-dynload/unicodedata.so

m urlparse /usr/lib/python2.4/urlparse.py
m uu /usr/lib/python2.4/uu.py
m warnings /usr/lib/python2.4/warnings.py
P wx /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/init.py

m wx.version /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/version.py
m wx._controls /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py
m wx.controls /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/controls.so

m wx._core /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_core.py
m wx.core /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/core.so
m wx._gdi /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_gdi.py

m wx.gdi /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/gdi.so
m wx._misc /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_misc.py
m wx.misc /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/misc.so

m wx._windows /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_windows.py
m wx.windows /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/windows.so
m zipimport

Missing modules:
? Carbon.File imported from macpath
? Carbon.Folder imported from tempfile
? Carbon.Folders imported from tempfile
? _emx_link imported from os
? ce imported from os
? mac imported from os

? nt imported from ntpath, os
? org.python.core imported from copy
? os.path imported from os
? os2 imported from os
? riscos imported from os
? riscosenviron imported from os
? riscospath imported from os

Copying /usr/lib/python2.4/lib-dynload/unicodedata.so
Copying /usr/lib/python2.4/lib-dynload/timemodule.so
Copying /usr/lib/wxPython-2.8.8.1-gtk2-unicode/lib/libwx_gtk2ud_core-2.8.so.0
Copying /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/controls.so

Copying /usr/lib/python2.4/lib-dynload/mathmodule.so
Copying /usr/lib/python2.4/lib-dynload/_socketmodule.so
Copying /usr/lib/wxPython-2.8.8.1-gtk2-unicode/lib/libwx_baseud_xml-2.8.so.0
Copying /usr/lib/python2.4/lib-dynload/structmodule.so

Copying /usr/lib/wxPython-2.8.8.1-gtk2-unicode/lib/libwx_baseud_net-2.8.so.0
Copying /usr/lib/wxPython-2.8.8.1-gtk2-unicode/lib/libwx_gtk2ud_html-2.8.so.0
Copying /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/gdi.so

Copying /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/misc.so
Copying /usr/lib/wxPython-2.8.8.1-gtk2-unicode/lib/libwx_gtk2ud_aui-2.8.so.0
Copying /usr/lib/python2.4/lib-dynload/binascii.so
Copying /usr/lib/python2.4/lib-dynload/itertoolsmodule.so

Copying /usr/lib/python2.4/lib-dynload/arraymodule.so
Copying /usr/lib/wxPython-2.8.8.1-gtk2-unicode/lib/libwx_gtk2ud_xrc-2.8.so.0
Copying /usr/lib/python2.4/lib-dynload/cStringIO.so
Copying /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/windows.so

Copying /usr/lib/wxPython-2.8.8.1-gtk2-unicode/lib/libwx_gtk2ud_adv-2.8.so.0
Copying /usr/lib/wxPython-2.8.8.1-gtk2-unicode/lib/libwx_baseud-2.8.so.0
Copying /usr/lib/python2.4/lib-dynload/_localemodule.so
Copying /usr/lib/python2.4/lib-dynload/_ssl.so

Copying /usr/lib/python2.4/lib-dynload/stropmodule.so
Copying /usr/lib/wxPython-2.8.8.1-gtk2-unicode/lib/libwx_gtk2ud_richtext-2.8.so.0
Copying /usr/lib/python2.4/site-packages/cjson.so
Copying /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/core.so

Copying /usr/lib/python2.4/lib-dynload/_randommodule.so
Copying /usr/lib/python2.4/lib-dynload/fcntlmodule.so
Frozen binary dist/backOffice created.
Done.

···

2008/8/18 Werner F. Bruhin werner.bruhin@free.fr

Hi,

Cole wrote:

Thank you so quickly back to me.

I try to use FreezePython --include-modules=encodings --install-dir

dist backOffice.py, or in the same issue,

I don’t use cx_freeze so not sure, but from the post I would think it

should be:

–include-modules=encodings.idna --install-dir dist backOffice.py

or try to find if there is something like:

–include-packages=encodings --install-dir dist backOffice.py

Werner

2008/8/18 Werner F. Bruhin <werner.bruhin@free.fr

mailto:werner.bruhin@free.fr>

何帅 wrote:
> I have a wxPython application that i can run no problem from
source, When I use the cx_Freeze it compiled into an executable
file after,
> Traceback (most recent call last):
> File "searchOrder.py", line 88, in OnSearchButton
>
> File "/usr/lib/python2.4/httplib.py", line 810, in request
> self._send_request(method, url, body, headers)
> File "/usr/lib/python2.4/httplib.py", line 827, in _send_request
> self.putrequest(method, url, **skips)
>
> File "/usr/lib/python2.4/httplib.py", line 760, in putrequest
> self.putheader('Host', "%s:%s" % (self.host.encode("idna"),
self.port))
> LookupError: unknown encoding: idna
>
>
With freeze utilities like py2exe and cx_freeze you sometimes have to
help it a bit in including all the files which are needed to run.
With py2exe one defines this in the packages option. Here is a post on
the cx_freeze list with a similar problem, it shows how to include a
particular encoding using include-modules, maybe there is also
something
like an include-packages.
[http://sourceforge.net/mailarchive/forum.php?thread_name=991ca2590701030133i1126f294u6f0a232f6d43ae73%40mail.gmail.com&forum_name=cx-freeze-users](http://sourceforge.net/mailarchive/forum.php?thread_name=991ca2590701030133i1126f294u6f0a232f6d43ae73%40mail.gmail.com&forum_name=cx-freeze-users)
<[http://sourceforge.net/mailarchive/forum.php?thread_name=991ca2590701030133i1126f294u6f0a232f6d43ae73%40mail.gmail.com&forum_name=cx-freeze-users](http://sourceforge.net/mailarchive/forum.php?thread_name=991ca2590701030133i1126f294u6f0a232f6d43ae73%40mail.gmail.com&forum_name=cx-freeze-users)>
Werner
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
<mailto:wxpython-users@lists.wxwidgets.org>
[http://lists.wxwidgets.org/mailman/listinfo/wxpython-users](http://lists.wxwidgets.org/mailman/listinfo/wxpython-users)


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users