bug: from_service_account_json fails without GOOGLE_APPLICATION_CREDENTIALS env var set
pypinfo-96fad88c6384.json
{
"type": "service_account",
"project_id": "pypinfo-167519",
"private_key_id": "redacted",
"private_key": "-----BEGIN PRIVATE KEY-----...redacted...-----END PRIVATE KEY-----\n",
"client_email": "moa-379@pypinfo-167519.iam.gserviceaccount.com",
"client_id": "109462256829445067003",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/moa-379%40pypinfo-167519.iam.gserviceaccount.com"
}
Ofek@Ofek-PC ~ $ from google.cloud.bigquery import Client Ofek@Ofek-PC ~ $ client = Client.from_service_account_json(r'C:\Users\Ofek\AppData\Local\creds\pypinfo-96fad88c6384.json') xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename> Traceback (most recent call last): File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\xonsh\__amalgam__.py", line 14826, in default run_compiled_code(code, self.ctx, None, 'single') File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\xonsh\__amalgam__.py", line 2085, in run_compiled_code func(code, glb, loc) File "<xonsh-code>", line 1, in <module> File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\cloud\client.py", line 71, in from_service_account_json return cls(*args, **kwargs) File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\cloud\bigquery\client.py", line 83, in __init__ project=project, credentials=credentials, _http=_http) File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\cloud\client.py", line 211, in __init__ _ClientProjectMixin.__init__(self, project=project) File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\cloud\client.py", line 167, in __init__ project = self._determine_default(project) File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\cloud\client.py", line 180, in _determine_default return _determine_default_project(project) File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\cloud\_helpers.py", line 181, in _determine_default_project _, project = google.auth.default() File "C:\Users\Ofek\Desktop\q\Miniconda3\lib\site-packages\google\auth\_default.py", line 282, in default raise exceptions.DefaultCredentialsError(_HELP_MESSAGE) 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.