问题
I'm trying to import datastore to my code in GAE like this way,
from google.cloud import datastore
unfortunately I got some error message in stackdriver like this
from grpc._cython import cygrpc as _cygrpc
ImportError: dynamic module does not define init function (initcygrpc)
or like this
from google.cloud.datastore_v1 import types
ImportError: cannot import name types
anyone know the reason or something? thanks in advance
====
env: standard
language: python
runtime: python27
回答1:
That is the generic client datastore library, which is no longer compatible with the standard environment GAE sandbox restrictions. See related GRPC and types import error in App Engine Datastore
From Google App Engine Standard Environment Client Libraries:
Note: For App Engine applications that are written in Python, the Google Datastore DB Client Library is no longer recommended; use the Google Datastore NDB Client Library instead.
So switch to NDB (I find it superior, with more functionality, optimized for GAE and better documented, right in the GAE-specific documentation area).
来源:https://stackoverflow.com/questions/51490175/cant-import-datastore-in-google-app-engine