Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 78a32b4

Browse files
committed
Give a better error message if the GAE env variable is missing.
1 parent 3360752 commit 78a32b4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

ndb/google_imports.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ def set_appengine_imports():
5353
normal_environment = False
5454
except ImportError:
5555
# If we are running locally but outside the context of App Engine.
56-
set_appengine_imports()
57-
from google.appengine.datastore import entity_pb
58-
normal_environment = True
56+
try:
57+
set_appengine_imports()
58+
from google.appengine.datastore import entity_pb
59+
normal_environment = True
60+
except ImportError:
61+
raise ImportError('Unable to find the App Engine SDK. '
62+
'Did you remember to set the "GAE" environment '
63+
'variable to be the path to the App Engine SDK?')
5964

6065
if normal_environment:
6166
from google.appengine.api.blobstore import blobstore as api_blobstore

0 commit comments

Comments
 (0)