【发布时间】:2012-06-11 18:03:44
【问题描述】:
我正在尝试使用 dev_appserver.py 测试 Google App Engine 应用,但是当我运行 import Crypto 时,我从 IOError(即无访问权限)回溯中得到以下摘录:
...
import Crypto
...
File "/System/Library/Frameworks/Python.framework/Versions
/2.7/lib/python2.7/zipfile.py", line 867, in read
return self.open(name, "r", pwd).read()
File "/System/Library/Frameworks/Python.framework/Versions
/2.7/lib/python2.7/zipfile.py", line 882, in open
zef_file = open(self.filename, 'rb')
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google
/appengine/tools/dev_appserver_import_hook.py", line 592, in __init__
raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: '/Library/Python/2.7/site-packages
/pycrypto-2.3-py2.7-macosx-10.7-intel.egg'
我在 Mac OS X 10.7 上,使用 Python 2.7 和 Google App Engine 1.6.6。
由于 PyCrypto is supported on Google App Engine,我希望它可以在开发服务器上工作。
我知道dev_appserver.py 会阻止加载外部文件。但是,我注意到appengine/tools/dev_appserver_import_hook.py 似乎在白名单中有所有必需的文件(例如_fastmath)。
注意,app.yaml 我有
libraries:
- name: pycrypto
version: latest
似乎我遗漏了一些明显但至关重要的东西。任何想法将不胜感激。
编辑更多详情见:https://code.google.com/p/googleappengine/issues/detail?id=12129
【问题讨论】:
-
code.google.com/p/googleappengine/issues/detail?id=4612 也相关但不一样。似乎 SDK 对鸡蛋不是很友好,而且它在 pycrypto 中非常明显,但它应该从站点包中获取东西。
-
顺便说一句,我将
Crypto(pycrypto 的根 python 文件夹)添加到我的应用程序的根目录中。
标签: google-app-engine pycrypto