The Virtualenv __future__ module works on the command line, but not while dev_appserver.py is running

I am launching a strange error when starting App Engine from my virtualenv . Here is the error:

File "/home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/tools/dev_appserver.py", line 2318, in LoadModuleRestricted description)
File "/home/matthew/dev/projects/webapp2/project/src/webapp2.py", line 11, in <module>
  from __future__ import with_statement
ImportError: No module named __future__
  • If I run python in my virtualenv and type import __future__, it imports.
  • If I deactivate my virtualenv and run dev_appserver.py , the application works.
  • But if my virtualenv is active, and I run dev_appserver.py (even though # 1 is true), the application does not work, and I get the error above.

Why __future__will it be available when starting the Python interpreter, but not dev_appserver.py?

+2
source share
1 answer

This is error 4339 . Make sure that you are using the SDK version 1.6.0, and then run:

$ cd /usr/local/google_appengine/google/appengine/tools
$ wget "http://googleappengine.googlecode.com/issues/attachment?aid=43390029000&name=dev_appserver_import_hook.patch&token=974d9f138a5604dc7eb0526156b26cc7" -O dev_appserver.patch
$ patch -p1 < dev_appserver.patch
+1
source

Source: https://habr.com/ru/post/1744994/


All Articles