json ImportError

Bug #943219 reported by Andreas Hasenack
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Landscape Client
Won't Fix
High
Chad Smith

Bug Description

landscape-client r465 introduced an "import json", which means we need to add a new dependency to the hardy package. In lucid and higher, json is part of python.

In hardy, we have python-json that seems to satisfy this.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

There is more to it, this json module is different, some tests fail:

[ERROR]: landscape.tests.test_configuration.SSLCertificateDataTest.test_fetch_base64_ssl_no_custom_ca

Traceback (most recent call last):
  File "/home/andreas/bzr/landscape-client/landscape/tests/mocker.py", line 146, in test_method_wrapper
    result = test_method()
  File "/home/andreas/bzr/landscape-client/landscape/tests/test_configuration.py", line 1983, in test_fetch_base64_ssl_no_custom_ca
    on_info=print_text)
  File "/home/andreas/bzr/landscape-client/landscape/configuration.py", line 515, in fetch_base64_ssl_public_certificate
    ca_dict = json.loads(content)
exceptions.AttributeError: 'module' object has no attribute 'loads'

Revision history for this message
Mike Milner (milner) wrote :

For hardy you need python-simplejson, not python-json. Simplejson is the library that was brought into stdlib so the API will be the same (i.e. it has loads)

Usually people use something like this:

try:
    import simplejson as json
except ImportError:
    import json

Chad Smith (chad.smith)
Changed in landscape-client:
assignee: nobody → Chad Smith (chad.smith)
status: New → In Progress
Chad Smith (chad.smith)
Changed in landscape-client:
status: In Progress → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.