cannot import name simplejson

Issue #236 new
Anonymous created an issue

django 1.7.2 pip install hg+https://bitbucket.org/jespern/django-piston

[Wed Jan 14 18:04:36 2015] [error] [client *.*.*.*]   File "/usr/local/lib/python2.7/dist-packages/piston/emitters.py", line 25, in <module>
[Wed Jan 14 18:04:36 2015] [error] [client *.*.*.*]     from django.utils import simplejson
[Wed Jan 14 18:04:36 2015] [error] [client *.*.*.*] ImportError: cannot import name simplejson

https://docs.djangoproject.com/en/dev/releases/1.5/#system-version-of-simplejson-no-longer-used

is it project dead?

Comments (2)

  1. glennrub NA

    This did not work for me.

    I followed this pull request and this worked to solve the json error: https://bitbucket.org/jespern/django-piston/pull-request/25/compatibility-fix-for-json-emitter-with/diff

    When fixing the Json issue, there is a new one popping up:

    __init__() got an unexpected keyword argument 'mimetype'
    

    This next issue seems to be that HttpResponse in piston resource.py uses "mimetype" named argument which is deprecated, the new argument is now called "content_type": https://docs.djangoproject.com/en/dev/ref/request-response/#id5

    swapping out the line 204 (trunk 230) from named argument "mimetype" to "content_type" seems to work:

    resp = HttpResponse(stream, mimetype=ct, status=status_code)
    
    resp = HttpResponse(stream, content_type=ct, status=status_code)
    
  2. Log in to comment