سؤال

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top