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

Timeout argument throw exception as wrong type (str v.s. float expected) (Snippet sample) #1017

Closed
changlichuan opened this issue Nov 1, 2023 · 0 comments · Fixed by #1051
Assignees
Labels
api: pubsub Issues related to the googleapis/python-pubsub API. samples Issues that are directly related to samples.

Comments

@changlichuan
Copy link

Minor issue in "python-pubsub/samples/snippets/quickstart/sub.py"

Environment details

  • OS type and version: macOS Sonoma 14.1
  • Python version: Python 3.10.11
  • pip version: pip 23.0.1
  • google-cloud-pubsub version: Version: 2.18.4

Steps to reproduce

  1. Start a simple pub/sub system on GCP (for example follow guide https://cloud.google.com/pubsub/docs/building-pubsub-messaging-system)
  2. as per the sample, instead of starting subscriber with "python sub.py $PROJECT sub_one" without a timeout argument, give it any timeout value.
  3. subscriber will exit immediately due to exception, as timeout is in str type, un-matching float type expected in code "streaming_pull_future.result(timeout=timeout)"
  4. in addition, help message on line 60 is inaccurate.

Exception captured:

'>' not supported between instances of 'str' and 'int'

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 googleapis/python-pubsub API. samples Issues that are directly related to samples.
Projects
None yet
3 participants