Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python AppEngine:没有名为pyasn1.compat.binary的模块_Python_Google App Engine_Oauth 2.0_Firebase Authentication_Webapp2 - Fatal编程技术网

Python AppEngine:没有名为pyasn1.compat.binary的模块

Python AppEngine:没有名为pyasn1.compat.binary的模块,python,google-app-engine,oauth-2.0,firebase-authentication,webapp2,Python,Google App Engine,Oauth 2.0,Firebase Authentication,Webapp2,在点击AppEngine服务器时,我不断遇到以下错误: ERROR 2017-09-20 07:16:06,978 wsgi.py:263] Traceback (most recent call last): File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle handler = _config_han

在点击AppEngine服务器时,我不断遇到以下错误:

ERROR    2017-09-20 07:16:06,978 wsgi.py:263] 
Traceback (most recent call last):
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 96, in LoadObject
    __import__(cumulative_path)
  File "/home/dclochri/Projects/react-seed/server/main.py", line 3, in <module>
    from controllers import organization_controller
  File "/home/dclochri/Projects/react-seed/server/controllers/organization_controller.py", line 4, in <module>
    import rest_controller as rest
  File "/home/dclochri/Projects/react-seed/server/controllers/rest_controller.py", line 4, in <module>
    import google.oauth2.id_token
  File "/home/dclochri/Projects/react-seed/lib/google/oauth2/id_token.py", line 22, in <module>
    from google.auth import jwt
  File "/home/dclochri/Projects/react-seed/lib/google/auth/jwt.py", line 53, in <module>
    from google.auth import _service_account_info
  File "/home/dclochri/Projects/react-seed/lib/google/auth/_service_account_info.py", line 22, in <module>
    from google.auth import crypt
  File "/home/dclochri/Projects/react-seed/lib/google/auth/crypt/__init__.py", line 39, in <module>
    from google.auth.crypt import rsa
  File "/home/dclochri/Projects/react-seed/lib/google/auth/crypt/rsa.py", line 17, in <module>
    from google.auth.crypt import _python_rsa
  File "/home/dclochri/Projects/react-seed/lib/google/auth/crypt/_python_rsa.py", line 27, in <module>
    from pyasn1.codec.der import decoder
  File "/home/dclochri/Projects/react-seed/lib/pyasn1/codec/der/decoder.py", line 7, in <module>
    from pyasn1.type import univ
  File "/home/dclochri/Projects/react-seed/lib/pyasn1/type/univ.py", line 11, in <module>
    from pyasn1.compat import octets, integer, binary
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime/sandbox.py", line 1132, in load_module
    raise ImportError('No module named %s' % fullname)
ImportError: No module named pyasn1.compat.binary
INFO     2017-09-20 07:16:06,982 module.py:821] default: "OPTIONS /rest/organizations/create HTTP/1.1" 500 -
requirements.txt

rest\u controller.py(代码段)

目录结构:

/
  lib/
    (deps from requirements.txt here)
  server/
    controllers/
      (controllers here)
    models/
      (models here)
    main.py
  src/
    (client code here - js, css, etc)
  app.yaml
  appengine_config.py
这发生在OSX约塞米蒂和Ubuntu 16.04上。我的进口产品有什么问题吗?oauth模块有问题吗?

非常感谢!事实证明,我的
app.yaml
config是罪魁祸首,特别是skip_files指令

错误的配置如下所示:

skip_files:
- ^(.git/.*)
- ^.*bin(/.*)?
- ^.*node_modules(/.*)?
- ^.*public(/.*)?
- ^.*src(/.*)?
- ^env$
- ^(.*/)?.*\.pyc$
更新后的配置如下所示:

# Skip any non-essential files for uploading during deploys.
skip_files:
# Defaults, see: https://cloud.google.com/appengine/docs/standard/python/config/appref#skip_files/
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
# Custom
- ^(.*/)?.*/bin/.*$
- ^(.*/)?.*/env/.*$
- ^(.*/)?.*/none_modules/.*$
- ^(.*/)?.*/public/.*$
- ^(.*/)?.*/src/.*$

因此,坏正则表达式和跳过错误文件的组合破坏了本地应用程序服务器,并修复了它,使其重新启动并运行。

您可以添加整个回溯吗?您是如何安装的
pyasn1
,它不在
requirements.txt
中?
pyasn1
是一个纯python库,没有C扩展(按照GAE沙盒的要求)?我更新了回溯,并包括了关于它是如何安装的说明(看起来它是
GoogleAuth
的依赖项)。关于C扩展的问题问得很好,但它看起来像是一个。是的,看起来不错。问题似乎在
pyasn1
内部。
pyasn1/compat
dir的内容是什么?嗯,我刚刚根据您的要求尝试了
导入google.oauth2.id\u令牌,效果很好。你的应用程序中有多种服务吗?例如:
pysan1/compat
的内容:
dateandtime.pyc
dateandtime.py
dateandtime.py
calling.py
octets.py
octets.pyc
string.py
binary.py>,
binary.pyc
binary.py>,
string.pyc
integer.pyc
调用.pyc
/
  lib/
    (deps from requirements.txt here)
  server/
    controllers/
      (controllers here)
    models/
      (models here)
    main.py
  src/
    (client code here - js, css, etc)
  app.yaml
  appengine_config.py
skip_files:
- ^(.git/.*)
- ^.*bin(/.*)?
- ^.*node_modules(/.*)?
- ^.*public(/.*)?
- ^.*src(/.*)?
- ^env$
- ^(.*/)?.*\.pyc$
# Skip any non-essential files for uploading during deploys.
skip_files:
# Defaults, see: https://cloud.google.com/appengine/docs/standard/python/config/appref#skip_files/
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
# Custom
- ^(.*/)?.*/bin/.*$
- ^(.*/)?.*/env/.*$
- ^(.*/)?.*/none_modules/.*$
- ^(.*/)?.*/public/.*$
- ^(.*/)?.*/src/.*$