文件无法访问,无法在谷歌应用引擎上导入库
Posted
技术标签:
【中文标题】文件无法访问,无法在谷歌应用引擎上导入库【英文标题】:file not accessible and cannot import library on google app engine 【发布时间】:2013-01-17 02:07:07 【问题描述】:好吧,我放弃了。当我在谷歌应用引擎上运行我的 web2py 应用程序时,我无法修复错误消息。我有下一个输出:
WARNING 2013-01-17 01:59:14,379 py_zipimport.py:139] Can't open zipfile
/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg:
IOError: [Errno 13] file not accessible: '/usr/local/lib/python2.7/dist-
packages/setuptools-0.6c11-py2.7.egg'
WARNING 2013-01-17 01:59:14,380 py_zipimport.py:139] Can't open zipfile
/usr/local/lib/python2.7/dist-packages/utils-0.1-py2.7.egg: IOError: [Errno
13] file not accessible: '/usr/local/lib/python2.7/dist-packages/utils-
0.1-py2.7.egg'
ERROR 2013-01-17 01:59:14,490 dev_appserver_import_hook.py:1251] Third
party package Crypto must be included in the "libraries:" clause of your
app.yaml file in order to be imported.
WARNING 2013-01-17 01:59:14,727 dev_appserver_import_hook.py:557] Blocking
access to skipped file "/home/michael/webdev/web2py/gluon/rocket.py"
我厌倦了将 Crypto 库添加到 app.yaml 但 GAE 不支持它。 另外,我不明白为什么“文件不可访问”。 有什么想法吗?
编辑 我的 app.yaml 文件是:
application: wormsapp
version: 1
api_version: 1
# use this line for Python 2.5
#
#runtime: python
# use these lines for Python 2.7
# upload app with: appcfg.py update web2py (where 'web2py' is web2py's root directory)
#
runtime: python27
threadsafe: true # true for WSGI & concurrent requests (Python 2.7 only)
default_expiration: "24h" # for static files
handlers:
- url: /(?P<a>.+?)/static/(?P<b>.+)
static_files: applications/\1/static/\2
upload: applications/(.+?)/static/(.+)
secure: optional
#- url: /favicon.ico
# static_files: applications/welcome/static/favicon.ico
# upload: applications/welcome/static/favicon.ico
- url: /favicon.ico
static_files: applications/crowdrandk/static/favicon.ico
upload: applications/crowdrank/static/favicon.ico
- url: /robots.txt
static_files: applications/welcome/static/robots.txt
upload: applications/welcome/static/robots.txt
- url: .*
# script: gaehandler.py # CGI
script: gaehandler.wsgiapp # WSGI (Python 2.7 only)
secure: optional
admin_console:
pages:
- name: Appstats
url: /_ah/stats
skip_files: |
^(.*/)?(
(app\.yaml)|
(app\.yml)|
(index\.yaml)|
(index\.yml)|
(#.*#)|
(.*~)|
(.*\.py[co])|
(.*/RCS/.*)|
(\..*)|
(applications/(admin|examples)/.*)|
((admin|examples|welcome)\.(w2p|tar))|
(applications/.*?/(cron|databases|errors|cache|sessions)/.*)|
((logs|scripts)/.*)|
(anyserver\.py)|
(web2py\.py)|
((cgi|fcgi|modpython|wsgi)handler\.py)|
(epydoc\.(conf|css))|
(httpserver\.log)|
(logging\.example\.conf)|
(route[rs]\.example\.py)|
(setup_(app|exe)\.py)|
(splashlogo\.gif)|
(parameters_\d+\.py)|
(options_std.py)|
(gluon/tests/.*)|
(gluon/(rocket|winservice)\.py)|
(contrib/(gateways|markdown|memcache|pymysql)/.*)|
(contrib/(populate|taskbar_widget)\.py)|
(google_appengine/.*)|
(.*\.(bak|orig))|
)$
builtins:
- remote_api: on
- appstats: on
- admin_redirect: on
- deferred: on
libraries:
- name: numpy
version: "latest"
- name: setuptools
version: "latest"
【问题讨论】:
你的 app.yaml 是什么样的? @MartinBlech 我将其添加到问题中。 您应该将crypto
添加到库中。
您能否将您尝试将 Crypto 添加到您的 app.yaml
的部分包括在内?
您还应该显示应用的文件夹结构。
【参考方案1】:
将此添加到库中:
- name: pycrypto
version: "2.6"
或
- name: pycrypto
version: latest
它应该可以工作。
【讨论】:
谢谢,它有效。你知道警告的原因是什么吗? 也许this 对你有帮助。 如果您显示您的应用程序的文件夹结构,也许我可以为您提供更多帮助。 另见this thread以上是关于文件无法访问,无法在谷歌应用引擎上导入库的主要内容,如果未能解决你的问题,请参考以下文章