“ImportError: No module named webapp2” after Linux SDK upgrade (1.9.35 -> 1.9.38)

After upgrading my GAE Python Linux SDK from version 1.9.35 to 1.9.38 my application stopped working, all requests are failing in similar manner:

ERROR    2016-06-10 17:55:06,100 wsgi.py:263] 
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 "/home/dancorn/src/apartsw/main/main.py", line 9, in <module>
    import webapp2
ImportError: No module named webapp2
INFO     2016-06-10 17:55:06,102 module.py:788] default: "GET / HTTP/1.1" 500 -

I first thought that I somehow screwed up my PyCharm config, but simply rolling back to 1.9.35 (by pointing my /usr/local/google_appengine symlink back to the respective SDK version dir) got things back working as expected.

The SDK release notes don’t appear to indicate anything related.

I found a similar report, but the suggested fix (rolling back) is not really acceptable down the road.

I also found this post, but I don’t have protobuf (explicitly) installed: How to solve a webapp2 import error after upgrading Google App Engine launcher?. Still chewing on the related posts which led me to this potentially related delta in the SDK, which I’ll investigate next:

diff google_appengine_1.9.35/_python_runtime.py google_appengine_1.9.38/_python_runtime.py
71a72,75
>   if 'google' in sys.modules:
>     google_path = os.path.join(os.path.dirname(__file__), 'google')
>     google_module = sys.modules['google']
>     google_module.__path__.append(google_path)
74,77c78
< 
< 
<   if 'google' in sys.modules:
<     del sys.modules['google']
---
>     google_module.__file__ = google_path

Any other investigation leads?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Update: The issue was fixed in SDK version 1.9.40.

The issue is already known to Google, introduced in 1.9.37:

From the report thread, as per Jon Parrot:

Thanks everyone for reporting this. We’ve reproduced the issue and and
fix is incoming. It won’t be in the next SDK release (38), but likely
will be in 39 or 40.

Until the fix is released an earlier unaffected SDK version (like 1.9.36) can be found here.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x