1
votes

I am writing a App Engine Standard python application, which accesses Datastore.

However importing google-cloud-datastore library triggers this error:

 File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/home/qiuchen/PycharmProjects/recsys_v1/main.py", line 6, in <module>
    from google.cloud import datastore
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime/sandbox.py", line 1147, in load_module
    raise ImportError('No module named %s' % fullname)
ImportError: No module named google.cloud.datastore

There are the beginning of my codes:

    import webapp2

    from google.appengine.ext import ndb

    from google.cloud import datastore
1
Side note: you shouldn't normally need the datastore library in a standard env python app - ndb is a better choice and it's already included.Dan Cornilescu
thx, I have used ndb to get the data. It is great tool!swing

1 Answers

1
votes

As the google-cloud-python GitHub page says, google-cloud-python client libraries are not currently supported for App Engine Standard.

The recommended approach is to use the ndb client library to access Datastore. ndb is specifically designed for App Engine Standard.