I am trying to use _ctypes with the Google AppEngine Development Server, according to this answer:
Debug Jinja2 in Google App Engine
Here is the code I use:
import os
if os.environ.get('SERVER_SOFTWARE', '').startswith('Dev'):
# Enable ctypes for Jinja debugging
from google.appengine.tools.dev_appserver import HardenedModulesHook
HardenedModulesHook._WHITE_LIST_C_MODULES += ['_ctypes', 'gestalt']
But I get this error:
ImportError: No module named simplejson
It comes from line 4: from google.appengine.tools.dev_appserver import HardenedModulesHook
I tried:
sudo pip install simplejson
The install succeeded, but I still get the error.
Those instructions are tied to the old dev appserver. The new dev appserver has a very different structure, which may be breaking that hack.
Try running using the old dev appserver. https://developers.google.com/appengine/docs/python/tools/old_devserver