Reputation: 20991
Super nub question time! I am trying to use simplejson on the google appengine. In a terminal on my machine I have simplejson installed and working. But my when I try to import it in a script running on the appengine I get an error saying no such library exists. If open the interactive console on my machine (from the link on http://localhost:8080/_ah/admin) and type "import simplejson" I get:
Traceback (most recent call last): File "/home/chris/google_appengine/google/appengine/ext/admin/init.py", line 210, in post exec(compiled_code, globals()) File "", line 1, in ImportError: No module named simplejson
Any thoughts?
Upvotes: 5
Views: 4965
Reputation: 74064
Look in django package:
from django.utils import simplejson as json
obj = json.loads(json_string)
Since Sdk 1.4.2 Json can be imported with the following statement:
import simplejson
Note that on Python 2.7 runtime you can use the native Json library.
Upvotes: 14
Reputation: 887
You no longer need to use the django package for simplejson on Google App Engine.
import simplejson as json
This is expecially handy for avoiding the flurry of warnings about django versions in your log file.
Upvotes: 10