chr*_*ley 5 python google-app-engine simplejson
超级小问题时间!我试图在google appengine上使用simplejson.在我的机器上的终端中,我安装了simplejson并正常工作.但是当我尝试在appengine上运行的脚本中导入它时,我得到一个错误,说没有这样的库存在.如果在我的机器上打开交互式控制台(从http:// localhost:8080/_ah/admin上的链接)并输入"import simplejson",我得到:
回溯(最近一次调用最后一次):文件"/ home/chris/google_appengine/google/appengine/ext/admin/init .py",第210行,在post exec(compiled_code,globals())文件"",第1行,在ImportError中:没有名为simplejson的模块
有什么想法吗?
sys*_*out 14
看看django包:
from django.utils import simplejson as json
obj = json.loads(json_string)
Run Code Online (Sandbox Code Playgroud)
由于可以使用以下语句导入Sdk 1.4.2 Json:
import simplejson
Run Code Online (Sandbox Code Playgroud)
请注意,在Python 2.7运行时,您可以使用本机Json库.
bit*_*her 10
您不再需要在Google App Engine上使用django包for simplejson.
import simplejson as json
Run Code Online (Sandbox Code Playgroud)
这对于避免日志文件中有关django版本的一连串警告特别方便.