Skip to content

AttributeError: 'str' object has no attribute '_credentials'  #3071

Closed
@kevmo314

Description

@kevmo314

Hi, I'm trying the example code and it's failing with the following exception:

>>> c = error_reporting.Client(project='<my-project-str>')
>>> try:
...   raise NameError
... except Exception:
...   c.report_exception()
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
NameError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "/opt/python/3.6.0/lib/python3.6/site-packages/google/cloud/error_reporting/client.py", line 348, in report_exception
    user=user)
  File "/opt/python/3.6.0/lib/python3.6/site-packages/google/cloud/error_reporting/client.py", line 277, in _send_error_report
    self.report_errors_api.report_error_event(error_report)
  File "/opt/python/3.6.0/lib/python3.6/site-packages/google/cloud/error_reporting/client.py", line 162, in report_errors_api
    self._report_errors_api = make_report_error_api(self._project)
  File "/opt/python/3.6.0/lib/python3.6/site-packages/google/cloud/error_reporting/_gax.py", line 39, in make_report_error_api
    client._credentials,
AttributeError: 'str' object has no attribute '_credentials'

Reading the source, this seems like a rather obvious error:

https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/error_reporting/google/cloud/error_reporting/client.py#L162

self._project is a string and at https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/error_reporting/google/cloud/error_reporting/_gax.py#L29 it's treated like a client object. Is this not the case?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions