Search code examples
pythoncx-freeze

LookupError: no codec search functions registered: can't find encoding


I have a Python2.7.9 application that I package into a single binary using cx_freeze. I recently updated sqlalchemy and other packages, then started hitting the following error. Any help is much appreciated!

    Copying data from package xml...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/cx_Freeze/initscripts/__startup__.py", line 14, in run
    module.run()
  File "/usr/local/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 26, in run
    exec(code, m.__dict__)
  File "vmop.py", line 2, in <module>
    import os, sys, logging, json, subprocess, pwd
  File "/usr/local/lib/python2.7/json/__init__.py", line 108, in <module>
    from .decoder import JSONDecoder
  File "/usr/local/lib/python2.7/json/decoder.py", line 24, in <module>
    NaN, PosInf, NegInf = _floatconstants()
  File "/usr/local/lib/python2.7/json/decoder.py", line 18, in _floatconstants
    _BYTES = '7FF80000000000007FF0000000000000'.decode('hex')
**LookupError: no codec search functions registered: can't find encoding**

Solution

  • seems like i just needed to import encodings in the may main program, the error is cryptic though:

    import encodings