ImportError: cannot import sandbox name

Over the past couple of days, this has begun to appear every time it starts dev_appserver.py:

from google.appengine.tools.devappserver2.python import sandbox
ImportError: cannot import name sandbox

Since I first encountered this when setting up a new environment, I decided that this was an error during installation. After stroking my head enough over the past 3 hours, I realized that it couldn’t be in the new setting, so I loaded it dev_appserver.pyinto a well-known working environment.

Again:

from google.appengine.tools.devappserver2.python import sandbox
ImportError: cannot import name sandbox

None of my application codes were changed, so it had to be something else.

0
source share
1 answer

It turned out that the SDK has changed.

I had a file with a name appengine_config.pythat (specifically for the development server) included a couple of C modules.

from google.appengine.tools.devappserver2.python import sandbox
sandbox._WHITE_LIST_C_MODULES += ['_ssl', '_socket']

, (, , ):

File "[...]/devappserver2/python/runtime/sandbox.py", line 1091, in load_module
    raise ImportError('No module named %s' % fullname)
ImportError: No module named _socket

runtime ? -, . .runtime :

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

, , ! ✅ .

🎉

+6

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


All Articles