views:

395

answers:

1

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?

+4  A: 

Look in django package:

from django.utils import simplejson as json
obj = json.loads(json_string)
systempuntoout
I've seen this answer given frequently to this question, but it seems a bit odd to me to import anything from the django package if the user is not using Django. Should non-Django users just add the generic simplejson directly to their project? Or is the version supplied by Google in the django package somehow better tuned to GAE then the generic version of simplejson? Since I use json so heavily I want to be sure that I am using the best version.
qwavel
Django is part of the SDK so i don't see problem to use it.You could also drop in simplejson in your project directory and use it directly.Remember that c speedup won't work, App Engine doesn't allow pythonextensions written in c
systempuntoout