Over the past couple days, this has started cropping up whenever I run dev_appserver.py
:
from google.appengine.tools.devappserver2.python import sandbox
ImportError: cannot import name sandbox
Since I was primarily coming across this in the setup of a new environment, I figured it must be a mistake of mine during setup. After enough head-scratching over the past 3 hours, I figured it couldn't be in the new setup, so I loaded up dev_appserver.py
in a known-to-be-working environment.
Yet again:
from google.appengine.tools.devappserver2.python import sandbox
ImportError: cannot import name sandbox
None of my app code had been changed, so it had to be something else.
It turned out the SDK had changed.
I had a file named
appengine_config.py
that (specifically for the development server) whitelisted a couple of C modules.When I disabled these lines, this issue was replaced with another (the one that was the reason those lines were there to mitigate):
Notice the
runtime
piece in the filepath? Apparently the location of the sandbox module had changed. So I added.runtime
to the import path:Then, after re-enabling those lines, everything was working again! ✅ Mission accomplished.