Skip to content
This repository was archived by the owner on Feb 13, 2026. It is now read-only.
This repository was archived by the owner on Feb 13, 2026. It is now read-only.

ClientOptions object missing attributes #23

Closed

Description

@Marcalberga

Environment details

  • GAE standard python37 runtime:
  • Python version: 3.7
  • google-cloud-core version: 1.4.0

Steps to reproduce

  1. Create google-cloud-storage client by json credentials: `Client.from_service_account_json(GCP_CREDENTIALS_FILE)

Code example

    def get_object(path, destination: Optional[str] = None) -> bytes:
        google_client = Client.from_service_account_json(GCP_CREDENTIALS_FILE)
        blob = Blob.from_string(path)
        content = blob.download_as_string(client=google_client)

Stack trace

  File "/srv/src/infrastructure/integration/google_cloud_storage.py", line 15, in get_object
    google_client = Client.from_service_account_json(GCP_CREDENTIALS_FILE)
  File "/env/lib/python3.7/site-packages/google/cloud/client.py", line 86, in from_service_account_json
    return cls(*args, **kwargs)
  File "/env/lib/python3.7/site-packages/google/cloud/storage/client.py", line 111, in __init__
    project=project, credentials=credentials, _http=_http
  File "/env/lib/python3.7/site-packages/google/cloud/client.py", line 250, in __init__
    Client.__init__(self, credentials=credentials, client_options=client_options, _http=_http)
  File "/env/lib/python3.7/site-packages/google/cloud/client.py", line 136, in __init__
    if credentials and client_options.credentials_file:
AttributeError: 'ClientOptions' object has no attribute 'credentials_file'

Also, going with simply client = storage.Client() launches the same error, but telling AttributeError: 'ClientOptions' object has no attribute 'scopes'

Edit: Fixed in project by forcing google-cloud-core==1.3.0

Activity

  1. kidproquo commented on Aug 5, 2020

    @kidproquo

    I am seeing the same issue with the new 1.4.0 release.

    Ref cloud.py line 136. credentials_file attribute does not exist in client_options if client_options is initialized with the empty constructor (line 134). There are other lines in the same file that refer to attributes for client_options that do not exist if it has been initialized using the empty constructor.

  2. s22chan commented on Aug 5, 2020

    @s22chan
    Contributor

    It's coming from this change a1e11e1
    , which doesn't update the requirements to pin google-api-core==1.19.0 for googleapis/python-api-core@a582936

  3. bommox commented on Aug 6, 2020

    @bommox

    Same problem here.

    My requirements:

    google-cloud-pubsub==1.5.0
    google-cloud-bigquery==1.24.0
    google-cloud-storage==1.28.1
    google-cloud-firestore==1.7.0
    
    

    And it fails when creating a Client for any of them:
    db = firestore.Client()

    File "/env/local/lib/python3.7/site-packages/google/cloud/firestore_v1/client.py", line 110, in __init__
    project=project, credentials=credentials, _http=None
    File "/env/local/lib/python3.7/site-packages/google/cloud/client.py", line 250, in __init__
    Client.__init__(self, credentials=credentials, client_options=client_options, _http=_http)
    File "/env/local/lib/python3.7/site-packages/google/cloud/client.py", line 143, in __init__
    scopes = client_options.scopes or self.SCOPE
    AttributeError: 'ClientOptions' object has no attribute 'scopes'
    
  4. busunkim96 commented on Aug 6, 2020

    @busunkim96
    Contributor

    Hi folks, sorry about this. @s22chan is correct that this is a result of not increasing the minimum pin on google-api-core.

    This should be resolved in 1.4.1. See #19 for the status of the release.

  5. added a commit that references this issue on Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions