Bug 7020

Summary: python-json should RDEPENDS python-codecs
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Magnus Olsson <magnus>
Component: devtools / tool chainAssignee: Alejandro Hernandez <alejandro.hernandez>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: alejandro.hernandez, meta.mr.watcher, meta.watcher, ross.burton
Version: unspecified   
Target Milestone: 1.8   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Magnus Olsson 2014-12-03 10:28:25 UTC
Without python-codecs, python-json is broken. Whenever you import the module in Python, you'll get the following error:

>>> import json
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/json/__init__.py", line 108, in <module>
    from .decoder import JSONDecoder
  File "/usr/lib/python2.7/json/decoder.py", line 24, in <module>
    NaN, PosInf, NegInf = _floatconstants()
  File "/usr/lib/python2.7/json/decoder.py", line 18, in _floatconstants
    _BYTES = '7FF80000000000007FF0000000000000'.decode('hex')
LookupError: no codec search functions registered: can't find encoding


The problem is that part of the JSON initialization code try to use the HEX codec.

This issue goes away if you also install python-codecs. python-2.7-manifest.inc should probably be re-generated with this RDEPENDS for python-json.
Comment 1 Ross Burton 2014-12-04 15:51:20 UTC
Magnus, can you send a tested patch?
Comment 2 Magnus Olsson 2014-12-05 10:28:14 UTC
Sure, I have posted a patch to http://patches.openembedded.org/patch/84475/

It applies a fix to Python v2.7. Python v3 might suffer from the same issue, but since Python 3 (core) doesn't seem to function at all without python3-codecs, it's probably something that will be addressed by #6967.
Comment 3 Alejandro Hernandez 2014-12-11 22:00:06 UTC
Fix, also python3 was indeed fixed by #6967

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=2b945a95444b722ac97c78783dd82f8d65b0254e