谷歌应用程序引擎 jsonpickle
有人让 jsonpickle 在谷歌应用程序引擎上工作吗?我的日志说没有模块,但肯定有一个模块,就像你出生一样。我正在使用 jsonpickle 0.32。
<type 'exceptions.ImportError'>: No module named jsonpickle
Traceback (most recent call last):
File "/base/data/home/apps/xxxxx/xxxxxxxxxxxxxxxxx/main.py", line 4, in <module>
import jsonpickle
Has anyone got jsonpickle working on the google app engine? My logs say there is no module but there is a module as sure as you're born. i'm using jsonpickle 0.32.
<type 'exceptions.ImportError'>: No module named jsonpickle
Traceback (most recent call last):
File "/base/data/home/apps/xxxxx/xxxxxxxxxxxxxxxxx/main.py", line 4, in <module>
import jsonpickle
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经成功地将 django.utils.simplejson 注册为 json 编码器/解码器。在这个真实的文件index.py中,Pizza类被编码并解码回来:
I have managed to make it work registering django.utils.simplejson as a json encoder/decoder. In this real file index.py class Pizza is encoded and decoded back:
正如这篇文章所解释的,
jsonpickle< /code> 需要几个底层 JSON 模块之一。我将按如下方式解决问题 - 将以下几行放在需要 jsonpickle 的模块的顶部:
这解决了问题:jsonpickle 需要
simplejson
(作为 JSON 模块之一)可以使用),但 GAE 将其命名为 django.utils.simplejson,因此您需要对其进行适当的“别名”。As this post explains,
jsonpickle
requires one of a few underlying JSON modules. I would fix the issue as follows -- put at the top of your module(s) that need jsonpickle the following few lines:This addresses the problem: jsonpickle needs
simplejson
(as one of the JSON modules it can use), but GAE has it asdjango.utils.simplejson
, so you need to "alias" it appropriately.