ImportError: cannot import name stubs for Google App Engine GAE Init Quick Start & Tutorial

邮差的信 提交于 2019-12-07 20:31:51

问题


Running into this error when trying quick start "hello" on gae-init

ERROR    2017-10-04 21:16:02,378 wsgi.py:263] 
    Traceback (most recent call last):
      File "/Users/anon/Desktop/Hacking/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
        handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
      File "/Users/anon/Desktop/Hacking/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py", line 351, in __getattr__
        self._update_configs()
      File "/Users/anon/Desktop/Hacking/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py", line 287, in _update_configs
        self._registry.initialize()
      File "/Users/anon/Desktop/Hacking/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py", line 160, in initialize
        import_func(self._modname)
      File "/Users/anon/Desktop/Hacking/hello/main/appengine_config.py", line 17, in <module>
        from google.appengine.tools.devappserver2.python import stubs
    ImportError: cannot import name stubs

I have followed all the directions for setting up requirements on gae-init...help! Same error for the tutorial on phone book.


回答1:


This is a known issue in gae-init; the location of the stubs package has changed in recent versions of the SDK, causing the ImportError.

According to the this comment on the bug report you can work around the problem by changing the import statement in appengine_config.py from

from google.appengine.tools.devappserver2.python import stubs

to

from google.appengine.tools.devappserver2.python.runtime import stubs



来源:https://stackoverflow.com/questions/46574365/importerror-cannot-import-name-stubs-for-google-app-engine-gae-init-quick-start

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!