1

I have forked python - doc - sample https://github.com/aliwo/python-docs-samples

and I'm trying to learn .py file below. python-docs-samples\video\cloud-client\labels\labels.py

error message occured:

google.auth.exceptions.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.

I checked all the google client website but could not find where to place my service account's key.json file. how to resolve this error?

Jerry
  • 399
  • 1
  • 2
  • 17

2 Answers2

2

If you are running the code on your local machine, you should be able to put the key.json file anywhere and follow the "Authenticating with Application Default Credentials" step on this page (on the bottom of the page).

Specifically:

$ export GOOGLE_APPLICATION_CREDENTIALS=<path_to_service_account_file>
dizcology
  • 170
  • 7
  • In window, how can I do that? – Jerry Jul 03 '17 at 02:32
  • I managed it in control panel - system environment variable. Thanks! – Jerry Jul 03 '17 at 03:10
  • Great! It seems that doing the following in the command line should also work: `C:\> set GOOGLE_APPLICATION_CREDENTIALS=` – dizcology Jul 06 '17 at 22:50
  • @ dizcology I thought variable set by 'set' command doesn't last after cmd session is closed. Did you try that after rebboting? – Jerry Jul 13 '17 at 09:34
  • You are most definitely right - I saw that instruction in one of the documentations and simply put it here just in case it might be useful for someone. – dizcology Jul 14 '17 at 01:28
2

enter image description here

control panel -> system environment variable -> set like this

Jerry
  • 399
  • 1
  • 2
  • 17