using with python3

Discussion in 'Python' started by Patrick Stinson, Dec 9, 2009.

  1. Has anyone tried using Python-3.1.1/Tools/freeze/ with the
    encodings package? It appears that encodings is required to intialize
    the interpreter, but PyImport_ImportFrozenModule is failing for the
    "encodings" module in marshal.c:r_object(), after trying to demarshal
    an object of type 0.

    The failing callstack looks like this:

    #0 0x00599114 in PyImport_ImportFrozenModule at import.c:2011
    #1 0x00598b14 in load_module at import.c:1830
    #2 0x0059aef2 in import_submodule at import.c:2631
    #3 0x0059a2ed in load_next at import.c:2436
    #4 0x00599629 in import_module_level at import.c:2153
    #5 0x00599a80 in PyImport_ImportModuleLevel at import.c:2204
    #6 0x00565b76 in builtin___import__ at bltinmodule.c:173
    #7 0x004e6cfc in PyCFunction_Call at methodobject.c:84
    #8 0x0048fbe5 in PyObject_Call at abstract.c:2160
    #9 0x0048fd94 in call_function_tail at abstract.c:2192
    #10 0x0048fe6e in PyObject_CallFunction at abstract.c:2216
    #11 0x0059b7f6 in PyImport_Import at import.c:2811
    #12 0x0059945e in PyImport_ImportModule at import.c:2064
    #13 0x00599551 in PyImport_ImportModuleNoBlock at import.c:2115
    #14 0x0058c99a in _PyCodecRegistry_Init at codecs.c:1042
    #15 0x00589a50 in _PyCodec_Lookup at codecs.c:110
    #16 0x005a7892 in get_codeset at pythonrun.c:145
    #17 0x005a7ea1 in Py_InitializeEx at pythonrun.c:272
    #18 0x005a7fbc in Py_Initialize at pythonrun.c:309

    As you can see it is calling _PyCodecRegistry_Init from
    get_codeset(). Is there something I can disable here to avoid this
    problem altogether? I am using the following script with to
    freeze the required modules:

    print('Hello world...')
    import dummy_threading

    import encodings
    import encodings.aliases
    import encodings.ascii
    import encodings.big5
    import encodings.big5hkscs
    import encodings.charmap
    import encodings.cp037
    import encodings.cp1006
    import encodings.cp1026
    import encodings.cp1140
    import encodings.cp1250
    import encodings.cp1251
    import encodings.cp1252
    import encodings.cp1253
    import encodings.cp1254
    import encodings.cp1255
    import encodings.cp1256
    import encodings.cp1257
    import encodings.cp1258
    import encodings.cp424
    import encodings.cp437
    import encodings.cp500
    import encodings.cp737
    import encodings.cp775
    import encodings.cp850
    import encodings.cp852
    import encodings.cp855
    import encodings.cp856
    import encodings.cp857
    import encodings.cp860
    import encodings.cp861
    import encodings.cp862
    import encodings.cp863
    import encodings.cp864
    import encodings.cp865
    import encodings.cp866
    import encodings.cp869
    import encodings.cp874
    import encodings.cp875
    import encodings.cp932
    import encodings.cp949
    import encodings.cp950
    import encodings.euc_jis_2004
    import encodings.euc_jisx0213
    import encodings.euc_jp
    import encodings.euc_kr
    import encodings.gb18030
    import encodings.gb2312
    import encodings.gbk
    import encodings.hp_roman8
    import encodings.hz
    import encodings.idna
    import encodings.iso2022_jp
    import encodings.iso2022_jp_1
    import encodings.iso2022_jp_2
    import encodings.iso2022_jp_2004
    import encodings.iso2022_jp_3
    import encodings.iso2022_jp_ext
    import encodings.iso2022_kr
    import encodings.iso8859_1
    import encodings.iso8859_10
    import encodings.iso8859_11
    import encodings.iso8859_13
    import encodings.iso8859_14
    import encodings.iso8859_15
    import encodings.iso8859_16
    import encodings.iso8859_2
    import encodings.iso8859_3
    import encodings.iso8859_4
    import encodings.iso8859_5
    import encodings.iso8859_6
    import encodings.iso8859_7
    import encodings.iso8859_8
    import encodings.iso8859_9
    import encodings.johab
    import encodings.koi8_r
    import encodings.koi8_u
    import encodings.latin_1
    import encodings.mac_arabic
    import encodings.mac_centeuro
    import encodings.mac_croatian
    import encodings.mac_cyrillic
    import encodings.mac_farsi
    import encodings.mac_greek
    import encodings.mac_iceland
    import encodings.mac_latin2
    import encodings.mac_roman
    import encodings.mac_romanian
    import encodings.mac_turkish
    import encodings.mbcs
    import encodings.palmos
    import encodings.ptcp154
    import encodings.punycode
    import encodings.raw_unicode_escape
    import encodings.shift_jis
    import encodings.shift_jis_2004
    import encodings.shift_jisx0213
    import encodings.tis_620
    import encodings.undefined
    import encodings.unicode_escape
    import encodings.unicode_internal
    import encodings.utf_16
    import encodings.utf_16_be
    import encodings.utf_16_le
    import encodings.utf_32
    import encodings.utf_32_be
    import encodings.utf_32_le
    import encodings.utf_7
    import encodings.utf_8
    import encodings.utf_8_sig
    Patrick Stinson, Dec 9, 2009
    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.
Similar Threads
  1. bart59
    Jun 9, 2004
  2. bart59
    Prateek R Karandikar
    Jun 9, 2004
  3. Patrick Stinson

    freeze in python3

    Patrick Stinson, Dec 10, 2009, in forum: Python
    Patrick Stinson
    Dec 11, 2009
  4. Replies:
    Olivier Renaud
    Mar 15, 2007
  5. Andrew Berg
    Andrew Berg
    Jun 16, 2012

Share This Page