Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

An error occurs when creating the cloud logging client #953

Copy link
Copy link

Description

@jaeseunglee
Issue body actions

I would like to use the following method without setting environment variables.

from google.cloud import logging
client = logging.Client.from_service_account_json(path of credentials.json)

However, the following error occurs.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/google/cloud/client.py", line 72, in from_service_account_json
    return cls(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/google/cloud/logging/client.py", line 107, in __init__
    project=project, credentials=credentials, _http=_http)
  File "/usr/local/lib/python2.7/dist-packages/google/cloud/client.py", line 213, in __init__
    _ClientProjectMixin.__init__(self, project=project)
  File "/usr/local/lib/python2.7/dist-packages/google/cloud/client.py", line 169, in __init__
    project = self._determine_default(project)
  File "/usr/local/lib/python2.7/dist-packages/google/cloud/client.py", line 182, in _determine_default
    return _determine_default_project(project)
  File "/usr/local/lib/python2.7/dist-packages/google/cloud/_helpers.py", line 181, in _determine_default_project
    _, project = google.auth.default()
  File "/usr/local/lib/python2.7/dist-packages/google/auth/_default.py", line 285, 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.

Is there a way to use without errors?

I do not want to use environment variables, but I want to use the credentials file directly when creating a Client object.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.