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

subscriber.py receive requires an args.timeout but it is missing from positional or optional arguments #2633

Closed
botscholar-scott opened this issue Dec 17, 2019 · 4 comments · Fixed by #2637
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@botscholar-scott
Copy link

In which file did you encounter the issue?

subscriber.py

GoogleCloudPlatform/python-docs-samples/pubsub/cloud-client

Did you change the file? If so, how?

No

Describe the issue

I was following the directions here [1] to receive from a subscription I created in the emulator and it fails saying it has no args.timeout. I see no way to provide this or any code that would parse this even if provided.

[1] https://cloud.google.com/pubsub/docs/emulator

python subscriber.py my-project-id receive my-sub
Traceback (most recent call last):
File "subscriber.py", line 541, in
receive_messages(args.project_id, args.subscription_name, args.timeout)
AttributeError: 'Namespace' object has no attribute 'timeout'

python subscriber.py my-project-id receive my-sub timeout=5
usage: subscriber.py [-h]
project_id
{list_in_topic,list_in_project,create,create-push,delete,update,receive,receive-custom-attributes,receive-flow-control,receive-synchronously,receive-synchronously-with-lease,listen_for_errors}
...
subscriber.py: error: unrecognized arguments: timeout=5

@gguuss
Copy link
Contributor

gguuss commented Dec 18, 2019

Reassigning to Alex who may have more information about what's going on with PubSub.

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Dec 18, 2019
@busunkim96 busunkim96 assigned hongalex and anguillanneuf and unassigned gguuss and hongalex Dec 18, 2019
@busunkim96
Copy link
Contributor

It looks like Alex is OOO right now. @anguillanneuf could you take a look?

@anguillanneuf
Copy link
Member

anguillanneuf commented Dec 18, 2019

@phx-srankin Thanks for noticing this! We recently updated all the subscriber samples in GitHub. Adding this line receive_parser.add_argument("--timeout", default=None, type=float) beneath the code here will help. I will work on an update.

receive_parser = subparsers.add_parser(
"receive", help=receive_messages.__doc__
)
receive_parser.add_argument("subscription_name")

Something else that you might notice when running this code (but won't affect receiving messages) is AttributeError: 'NoneType' object has no attribute 'received_messages'. It has been fixed via this PR but the update will only show up in the next release of the library. Friendly ping to @pradn and @plamut to cut the next release asap.

Thanks for your patience!

@pradn
Copy link
Contributor

pradn commented Dec 18, 2019

Thanks @phx-srankin for a good bug report. And, thanks @anguillanneuf for taking a look at this.

We'll be cutting the next release the week of Jan 20 b/c time-off / holidays.

@busunkim96 busunkim96 removed the triage me I really want to be triaged. label Dec 18, 2019
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Dec 18, 2019
@busunkim96 busunkim96 added api: pubsub Issues related to the Pub/Sub API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed triage me I really want to be triaged. labels Dec 18, 2019
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants