【发布时间】:2017-02-10 22:19:46
【问题描述】:
我 pip install --upgrade google-cloud-storage -t libs 到我的应用引擎应用程序。
在 appengine_config.py 中,我添加了:
vendor.add('libs')
vendor.add(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'libs'))
它适用于在线应用引擎,但不适用于本地应用引擎沙箱。
ERROR 2016-10-03 00:22:01,311 wsgi.py:263]
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/Users/charlesng/Documents/Codes/python/web/myapp/src/main.py", line 19, in <module>
from handlers import page_handlers, user_handlers, repo_handlers, doc_handlers
File "/Users/charlesng/Documents/Codes/python/web/myapp/src/handlers/repo_handlers.py", line 28, in <module>
from google.cloud import storage
File "/Users/charlesng/Documents/Codes/python/web/myapp/src/libs/google/cloud/storage/__init__.py", line 42, in <module>
from google.cloud.storage.batch import Batch
File "/Users/charlesng/Documents/Codes/python/web/myapp/src/libs/google/cloud/storage/batch.py", line 29, in <module>
from google.cloud.exceptions import make_exception
File "/Users/charlesng/Documents/Codes/python/web/myapp/src/libs/google/cloud/exceptions.py", line 24, in <module>
from google.cloud._helpers import _to_bytes
File "/Users/charlesng/Documents/Codes/python/web/myapp/src/libs/google/cloud/_helpers.py", line 62, in <module>
_USER_ROOT = os.path.expanduser('~')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 262, in expanduser
userhome = pwd.getpwuid(os.getuid()).pw_dir
KeyError: 'getpwuid(): uid not found: 429123195'
文件夹结构:
myapp/
/src/main.py
/src/libs
/env/(virtualenv files)
/env/lib
通常,如果您 pip 库,文件在 lib/ 中,但对于应用引擎第三方库,我们必须 pip -t libs 以便它们在 libs 中而不是在 lib 中。
当我从 google.cloud 导入存储使用 python2 或 python3 时,它们很好,但没有运行 appengine 沙箱,因为它调用的是 src/libs/google/cloud 而不是 env/lib/google/cloud。
我应该如何解决这个问题?任何建议或指导将不胜感激。
【问题讨论】:
-
在您的本地机器上,您的 /etc/passwd 中有条目 4294967295 吗?
-
哦,所以你需要在 /etc/passwd 中添加 4294967295 吗?你会怎么做?我在 etc/passwd 文件中看到很多路径。
-
不,你不需要添加任何东西。我只是想问一下这个号码是否存在。
-
不,我不这么认为。
-
这个程序为你输出了什么:paste.fedoraproject.org/442456/54618061
标签: python google-app-engine google-cloud-storage