我已经创建了一个简单的Google App Engine应用程序,可与Google docs api一起使用。
它需要app_engine
中的google.auth
模块(来自google.auth import app_engine),我已将其安装在/lib
文件夹中,并将vendor.add('lib')
添加到{{1 }}
但是,当我从Google Cloud SDK部署到App Engine标准环境时,出现以下错误:
“ importError:无法导入名称库”
我也收到错误消息:
'ImportError:没有名为pyasn1.codec.der的模块'
对于这两个问题,我已经仔细检查了appengine_config.py
文件夹中是否确实存在基本模块和pyasn1.codec.der
模块。在两种情况下都是。
有人知道这个问题可能是什么吗?
lib
此处有完整的反馈:
基础
from google.auth import app_engine
import googleapiclient.discovery
pyasn1.codec.der
Traceback (most recent call last):
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/7679791231c143f9/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/7679791231c143f9/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/7679791231c143f9/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/base/data/home/apps/e~emailtest69/20190507t182648.418021119853034691/main.py", line 23, in <module>
from google.auth import app_engine
File "/base/data/home/apps/e~emailtest69/20190507t182648.418021119853034691/lib/google/auth/app_engine.py", line 29, in <module>
from google.auth import crypt
File "/base/data/home/apps/e~emailtest69/20190507t182648.418021119853034691/lib/google/auth/crypt/__init__.py", line 38, in <module>
from google.auth.crypt import base
ImportError: cannot import name base
答案 0 :(得分:0)
确保正确安装了Python模块和对象。 请注意,在App Engine Python运行时环境中,必须将Python客户端库出售给您的应用程序,因为它们未安装在其中。
此处讨论了更多针对Google Docs API的参考。
还要确保您已获得[2]的凭据:
从google.auth导入app_engine
凭据= app_engine.Credentials()
由于错误来自google.auth.crypt模块,因此您也可以在此页面上查看[3]以获取更多信息。
[1] https://developers.google.com/docs/api/how-tos/libraries#python
[2] https://github.com/googleapis/google-auth-library-python/blob/master/docs/user-guide.rst#the-app-engine-standard-environment
[3] https://google-auth.readthedocs.io/en/latest/reference/google.auth.crypt.html#module-google.auth.crypt
答案 1 :(得分:0)
我遇到了同样的问题,我转到“ google”目录并手动删除“ auth”。 我运行后
Interest
它开始工作。