Skip to content Skip to sidebar Skip to footer

Google App Engine: Importerror: No Module Named Appengine.ext

I am trying to write a test for my GAE programme which uses the datastore. Following Google's Documentation, I see that I should be adding the path to my SDK into my PYTHONPATH. I

Solution 1:

I run into these problems a lot less by always running inside a virtualenv.

I agree with snakecharmerrb you should get print google.__file__ or google.__path_ to figure out exactly what you're importing.

This snippet might also solve your problem:

import google

gae_dir = google.__path__.append('/path/to/appengine_sdk//google_appengine/google')
sys.path.insert(0, gae_dir) # might not be necessaryimport google.appengine # now it's on your import path`

Solution 2:

Which version of app engine SDK are you using? I am using the latest SDK (1.9.34). I find the below snippet in my ~/google_appengine/google/appengine/ext/ndb/google_imports.py file

try:
    from google3.storage.onestore.v3 import entity_pb
    normal_environment = Falseexcept ImportError:
    # If we are running locally but outside the context of App Engine.try:
      set_appengine_imports()
      from google.appengine.datastore import entity_pb
      normal_environment = Trueexcept ImportError:
      raise ImportError('Unable to find the App Engine SDK. ''Did you remember to set the "GAE" environment ''variable to be the path to the App Engine SDK?')

But in your stack trace, after google3.storage import it doesn't seem to go inside the except clause.

So try the same code with latest SDK.

Post a Comment for "Google App Engine: Importerror: No Module Named Appengine.ext"