OK here's an update of how I fixed this issue, with a question at the end. It's true that you have to run: export APPLICATION_ID=myapplicationnamegoeshere before you can run "python main.py" to run the example that connects to the (local) Cloud Datastore. Before you run this command you have to run these commands to bring up a local Datastore: sudo apt-get install google-cloud-sdk-datastore-emulator gcloud beta emulators datastore start $(gcloud beta emulators datastore env-init)
Then if you follow the instructions you can find in the docs the application will run OK. I think the docs have to be updated to include these info. My question is the following: How is it possible that when I run the python 3 version of all these commands (3.16 on my Ubuntu), and even using "virtualenv -p python3 envname", I get the "ModuleNotFoundError: No module named 'google.type'" error, but with the Python 2.17 version of the commands the application runs OK. Is this supposed to be like this? I thought the environment the app runs on was supposed to be 3.17? El viernes, 28 de septiembre de 2018, 1:28:34 (UTC+1), vvv vvv escribió: > > > Hello, after installing everything, I am trying to run > * > ~/python-docs-samples/appengine/standard_python37/building-an-app/building-an-app-2* > *building-an-app/building-an-app-1* built and run successfully, my > problem is with the rest in the series which use the cloud datastore. > When i start my virtual environment and run > pip3 install -r requirements.txt > > python3 main.py > > > I get Traceback (most recent call last): > File "main.py", line 20, in <module> > from google.cloud import datastore > File > "/home/neptune/env/local/lib/python3.6/site-packages/google/cloud/datastore/__init__.py" > , line 61, in <module> > from google.cloud.datastore.batch import Batch > File > "/home/neptune/env/local/lib/python3.6/site-packages/google/cloud/datastore/batch.py" > , line 24, in <module> > from google.cloud.datastore import helpers > File > "/home/neptune/env/local/lib/python3.6/site-packages/google/cloud/datastore/helpers.py" > , line 24, in <module> > from google.type import latlng_pb2 > ModuleNotFoundError: No module named 'google.type' > > > If on the other hand I run: > > pip install -r requirements.txt > > python main.py > > > The output is: > File "main.py", line 22, in <module> > datastore_client = datastore.Client() > ... > psep = app_id.find(_PARTITION_SEPARATOR) > AttributeError: 'NoneType' object has no attribute 'find' > > > I found here ( > https://github.com/GoogleCloudPlatform/google-cloud-datastore/issues/168) > in the end that I have to set APPLICATION_ID. How do I do this, and is this > documented somewhere? > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/49bcc39d-a656-4df8-afed-e999e6412df7%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
