How to solve a webapp2 import error after upgrading Google App Engine launcher?

点点圈 提交于 2019-12-08 13:31:02

问题


We just upgraded Google App Engine Launcher on a Mac and a script that was working fine now is throwing a "ImportError: No module named webapp2" error when launching it via PyCharm.

Here is the trace:

Traceback (most recent call last): File "/usr/local/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) File "/usr/local/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler handler, path, err = LoadObject(self._handler) File "/usr/local/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject obj = import(path[0]) File "/Users/Michael/Documents/GitHub/velocitybyathla/main.py", line 17, in import webapp2 ImportError: No module named webapp2 INFO 2016-06-02 05:39:58,835 module.py:788] default: "GET / HTTP/1.1" 500 -

We tried adding the path to Python in Google App Engine Launcher as suggested here - but the error remains.

webapp2 is clearly installed. It worked before the upgrade and if we do "pip install webapp2" it says it is present.

We also tried "Make Symlinks" without success.

How has Google App Engine Launcher lost its path to the module? How do we fix it?


回答1:


Here was our solution.

(1) We reinstalled Python 2.7 (may not be necessary)

(2) We reinstalled the Google App Engine SDK (may not be necessary)

(3) We upgraded pip to the latest version (may not be necessary)

pip install --upgrade pip

(4) We uninstalled protobuf per this answer. (necessary)

pip uninstall protobuf

After this our app started running. But then we got a missing "module _ssl" error. We fixed that by adding this:

(5) We modified the app.yaml file: - name: ssl version: latest

Now our app is working properly again.




回答2:


HI I have resolved this issue by making a lib folder in my project and installing all dependencies there including webapp2,webobb and others that my application use.

You could do that by typing pip install <dependecy> -t lib

If you have appengine_config.py , then you are already adding lib to your path, you can verify it by looking at

from google.appengine.ext import vendor
# Add any libraries installed in the "lib" folder.
vendor.add('lib')

you could always do this otherwise

import sys
sys.path.insert(0, 'libs')



回答3:


I get the similar error in 1.9.37 and 1.9.38 in Windows7. When I re-install the 1.9.36 version, everything works fine.

I think this is the issue from Google App Engine team. You can check out this issue : Issue 12963: ImportError on SDK provided libraries since 1.9.37

So my quick solution is simply to re-install the old version (1.9.36 or previous).



来源:https://stackoverflow.com/questions/37583769/how-to-solve-a-webapp2-import-error-after-upgrading-google-app-engine-launcher

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