Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'ProtobufEntry' object has no attribute 'text_payload' #1807

Closed
waprin opened this issue May 18, 2016 · 11 comments
Closed

AttributeError: 'ProtobufEntry' object has no attribute 'text_payload' #1807

waprin opened this issue May 18, 2016 · 11 comments
Assignees
Labels
api: logging Issues related to the Cloud Logging API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@waprin
Copy link
Contributor

waprin commented May 18, 2016

Reproducing this is blocked by #1806, but I wanted to make sure it gets recorded this popped up. Still on client.list_entries:

  File "list_logs.py", line 45, in list_logs
    format((timestamp, entry.text_payload, entry.struct_payload)))
AttributeError: 'ProtobufEntry' object has no attribute 'text_payload'
@dhermes dhermes added api: logging Issues related to the Cloud Logging API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels May 18, 2016
@waprin
Copy link
Contributor Author

waprin commented May 18, 2016

Actually if I remove the #1806 validation I reliably reproduce this.

@waprin
Copy link
Contributor Author

waprin commented May 18, 2016

I am now realizing that this is in my own code, however that was copied from the docs so maybe just a docs error.

@waprin
Copy link
Contributor Author

waprin commented May 23, 2016

@dhermes Still need to clean up the docs. Is the idea that now you will just reference payload directly for each LogEntry type? Also, the docs say its logger.delete_entries() when now its logger.delete(). Can make the PR if you'd like.

@tseaver
Copy link
Contributor

tseaver commented May 23, 2016

@waprin, can you show the example which is triggering the traceback?

Is the idea that now you will just reference payload directly for each LogEntry type?

Yes, each entry type (TextEntry, StructEntry, and ProtobufEntry) will have a payload attribute. For ProtobufEntry objects, you can use the parse_mesage method to get an actual protobuf: by default, it comes across the wire as a mapping.

Also, the docs say its logger.delete_entries() when now its logger.delete(). Can make the PR if you'd like.

Thanks, that would be great.

@waprin
Copy link
Contributor Author

waprin commented May 23, 2016

http://googlecloudplatform.github.io/gcloud-python/stable/logging-usage.html .

from gcloud import logging
>>> client = logging.Client()
>>> entries, token = client.list_entries()  # API call
>>> for entry in entries:
...    timestamp = entry.timestamp.isoformat()
...    print('%sZ: %s | %s' %
...          (timestamp, entry.text_payload, entry.struct_payload))

There are some other changes as well, I am writing the samples for python-docs-samples then I'll swing by and update it all.

@dhermes
Copy link
Contributor

dhermes commented May 25, 2016

Thanks!

@waprin
Copy link
Contributor Author

waprin commented Jun 3, 2016

Still planning on fixing these docs, just waiting for your next release so I have all the working samples then I'll update the docs here.

@dhermes
Copy link
Contributor

dhermes commented Jun 7, 2016

I can cut a release tomorrow. @tseaver Any reason not to?

@tseaver
Copy link
Contributor

tseaver commented Jun 7, 2016

@dhermes nope.

@dhermes
Copy link
Contributor

dhermes commented Jun 7, 2016

OK starting process now. I'll cc you on the release PR @waprin

@tseaver
Copy link
Contributor

tseaver commented Jun 15, 2016

Docs fixed in #1848

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the Cloud Logging API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants