This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: freeze tool cannot handle JSON module properly
Type: behavior Stage: resolved
Components: Demos and Tools Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Elazar.Leibovich, sam.sp, serhiy.storchaka
Priority: normal Keywords:

Created on 2010-07-22 16:20 by sam.sp, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg111188 - (view) Author: Sam Saint-Pettersen (sam.sp) Date: 2010-07-22 16:20
Freeze tool can generate Makefile and C code for Python programs using the JSON module. The code can be compiled fine, but when a program using the JSON module is run, this is returned:

Traceback (most recent call last): 
2	  File "myProgram.py", line 15, in <module> 
3	    import json 
4	  File "/usr/local/lib/python2.7/json/__init__.py", line 108, in <module> 
5	    from .decoder import JSONDecoder 
6	  File "/usr/local/lib/python2.7/json/decoder.py", line 24, in <module> 
7	    NaN, PosInf, NegInf = _floatconstants() 
8	  File "/usr/local/lib/python2.7/json/decoder.py", line 18, in _floatconstants 
9	    _BYTES = '7FF80000000000007FF0000000000000'.decode('hex') 
10	LookupError: unknown encoding: hex 

Something to do with .decode('hex') apparently.
msg111231 - (view) Author: Sam Saint-Pettersen (sam.sp) Date: 2010-07-23 01:19
Problem occurs with "frozen" programs if:


from encodings import hex_codec 

...is not explicitly written in the script.
msg140105 - (view) Author: Elazar Leibovich (Elazar.Leibovich) Date: 2011-07-11 10:36
Similar problem occurs if you do not specify

   from encodings import ascii

You can get

   LookupError: unknown encoding: ascii
msg370427 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-05-31 12:04
.decode('hex') no longer used in Python 3.
History
Date User Action Args
2022-04-11 14:57:04adminsetgithub: 53575
2020-05-31 12:04:06serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg370427

resolution: out of date
stage: resolved
2011-07-11 10:36:30Elazar.Leibovichsetstatus: pending -> open
nosy: + Elazar.Leibovich
messages: + msg140105

2010-07-23 01:19:36sam.spsetstatus: open -> pending

messages: + msg111231
2010-07-22 16:20:55sam.spcreate