python-docs-samples icon indicating copy to clipboard operation
python-docs-samples copied to clipboard

i am getting some sort of environment error at this point " db = firestore.Client()"

Open MAnand59 opened this issue 8 years ago • 2 comments

why do i get this error when i run this code....Btw i think something is wrong with "db = firestore.Client()" this part....And i am trying to run this on my "raspberry pi 3"


Traceback (most recent call last): File "/home/pi/Desktop/test.py", line 8, in db = firestore.Client() File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/firestore_v1beta1/client.py", line 89, in init project=project, credentials=credentials, _http=None) File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 215, in init _ClientProjectMixin.init(self, project=project) File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 169, in init project = self._determine_default(project) File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/client.py", line 182, in _determine_default return _determine_default_project(project) File "/home/pi/.local/lib/python2.7/site-packages/google/cloud/_helpers.py", line 179, in _determine_default_project _, project = google.auth.default() File "/home/pi/.local/lib/python2.7/site-packages/google/auth/_default.py", line 283, in default raise exceptions.DefaultCredentialsError(_HELP_MESSAGE) DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credential and re-run the application. For more information, please see https://developers.google.com/accounts/docs/application-default-credentials.

MAnand59 avatar Apr 06 '18 12:04 MAnand59

@ryanmats FYI

jabubake avatar Apr 07 '18 00:04 jabubake

@MAnand59 Looks like you need to set up authentication to call the Firestore API. To do this you'll need to download a service account key (a JSON file) to your raspberry pi and then set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to that file on the device.

See https://cloud.google.com/firestore/docs/quickstart#set_up_your_development_environment for more details.

Let me know if you have more problems!

ryanmats avatar Apr 07 '18 03:04 ryanmats