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

grpc samples: specify type on --sample_rate to prevent TypeError #513

Merged
merged 1 commit into from
Sep 12, 2016

Conversation

zackse
Copy link
Contributor

@zackse zackse commented Sep 9, 2016

The --sample_rate argument in speech/grpc/transcribe.py and speech/grpc/transcribe_async.py did not specify a type, which meant the value would be treated as a string, resulting in an exception during protobuf conversion:

$ python transcribe.py --encoding FLAC --sample_rate 16000 gs://path/to/my.flac
Traceback (most recent call last):
  File "transcribe.py", line 95, in <module>
    main(args.input_uri, args.encoding, args.sample_rate)
  File "transcribe.py", line 66, in main
    language_code='en-US',  # a BCP-47 language tag
  File "/Users/zackse/code/python/contrib/python-docs-samples/speech/api-client/env/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 535, in init
    _ReraiseTypeErrorWithFieldName(message_descriptor.name, field_name)
  File "/Users/zackse/code/python/contrib/python-docs-samples/speech/api-client/env/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 455, in _ReraiseTypeErrorWithFieldName
    six.reraise(type(exc), exc, sys.exc_info()[2])
  File "/Users/zackse/code/python/contrib/python-docs-samples/speech/api-client/env/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 533, in init
    setattr(self, field_name, field_value)
  File "/Users/zackse/code/python/contrib/python-docs-samples/speech/api-client/env/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 669, in field_setter
    new_value = type_checker.CheckValue(new_value)
  File "/Users/zackse/code/python/contrib/python-docs-samples/speech/api-client/env/lib/python2.7/site-packages/google/protobuf/internal/type_checkers.py", line 132, in CheckValue
    raise TypeError(message)
TypeError: '16000' has type <type 'str'>, but expected one of: (<type 'int'>, <type 'long'>) for field RecognitionConfig.sample_rate

Hope this helps. Thanks for this service and the samples!

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@googlebot googlebot added the cla: no This human has *not* signed the Contributor License Agreement. label Sep 9, 2016
@theacodes theacodes added the ML label Sep 9, 2016
@zackse
Copy link
Contributor Author

zackse commented Sep 9, 2016

I signed the CLA.

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Sep 9, 2016
@puneith
Copy link
Contributor

puneith commented Sep 11, 2016

@zackse LGTM. Thanks for your contribution!

@puneith puneith self-assigned this Sep 11, 2016
@jerjou jerjou merged commit 4c7741d into GoogleCloudPlatform:master Sep 12, 2016
engelke pushed a commit that referenced this pull request Nov 28, 2022
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-cloud-asset](https://github.com/googleapis/python-asset) | `==3.14.1` -> `==3.14.2` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-asset/3.14.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-asset/3.14.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-asset/3.14.2/compatibility-slim/3.14.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-asset/3.14.2/confidence-slim/3.14.1)](https://docs.renovatebot.com/merge-confidence/) |
| [google-cloud-bigquery](https://github.com/googleapis/python-bigquery) | `==3.3.3` -> `==3.3.5` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/3.3.5/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/3.3.5/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/3.3.5/compatibility-slim/3.3.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/3.3.5/confidence-slim/3.3.3)](https://docs.renovatebot.com/merge-confidence/) |
| [google-cloud-pubsub](https://github.com/googleapis/python-pubsub) | `==2.13.7` -> `==2.13.9` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.13.9/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.13.9/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.13.9/compatibility-slim/2.13.7)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.13.9/confidence-slim/2.13.7)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/python-asset</summary>

### [`v3.14.2`](https://github.com/googleapis/python-asset/releases/tag/v3.14.2)

[Compare Source](https://github.com/googleapis/python-asset/compare/v3.14.1...v3.14.2)

## 🤖 I have created a release *beep* *boop*

#### [3.14.2](https://github.com/googleapis/python-asset/compare/v3.14.1...v3.14.2) (2022-10-10)

##### Bug Fixes

-   **deps:** Allow protobuf 3.19.5 ([#&#8203;508](https://github.com/googleapis/python-asset/issues/508)) ([818abbb](https://github.com/googleapis/python-asset/commit/818abbbcbb829a726d18ba1e7e7e03f997d4256a))

</details>

<details>
<summary>googleapis/python-bigquery</summary>

### [`v3.3.5`](https://github.com/googleapis/python-bigquery/releases/tag/v3.3.5)

[Compare Source](https://github.com/googleapis/python-bigquery/compare/v3.3.3...v3.3.5)

##### Bug Fixes

-   **deps:** Allow protobuf 3.19.5 ([#&#8203;1379](https://github.com/googleapis/python-bigquery/issues/1379)) ([3e4a074](https://github.com/googleapis/python-bigquery/commit/3e4a074a981eb2920c5f9a711c253565d4844858))

</details>

<details>
<summary>googleapis/python-pubsub</summary>

### [`v2.13.9`](https://github.com/googleapis/python-pubsub/releases/tag/v2.13.9)

[Compare Source](https://github.com/googleapis/python-pubsub/compare/v2.13.7...v2.13.9)

##### Bug Fixes

-   **deps:** Allow protobuf 3.19.5 ([#&#8203;801](https://github.com/googleapis/python-pubsub/issues/801)) ([fa23503](https://github.com/googleapis/python-pubsub/commit/fa235033481783c2ec378b2a26b223bdff206461))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-asset).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMzAuMCIsInVwZGF0ZWRJblZlciI6IjMyLjIzMC4wIn0=-->
dandhlee pushed a commit that referenced this pull request Nov 29, 2022
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-cloud-asset](https://github.com/googleapis/python-asset) | `==3.14.1` -> `==3.14.2` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-asset/3.14.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-asset/3.14.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-asset/3.14.2/compatibility-slim/3.14.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-asset/3.14.2/confidence-slim/3.14.1)](https://docs.renovatebot.com/merge-confidence/) |
| [google-cloud-bigquery](https://github.com/googleapis/python-bigquery) | `==3.3.3` -> `==3.3.5` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/3.3.5/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/3.3.5/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/3.3.5/compatibility-slim/3.3.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-bigquery/3.3.5/confidence-slim/3.3.3)](https://docs.renovatebot.com/merge-confidence/) |
| [google-cloud-pubsub](https://github.com/googleapis/python-pubsub) | `==2.13.7` -> `==2.13.9` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.13.9/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.13.9/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.13.9/compatibility-slim/2.13.7)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-pubsub/2.13.9/confidence-slim/2.13.7)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/python-asset</summary>

### [`v3.14.2`](https://github.com/googleapis/python-asset/releases/tag/v3.14.2)

[Compare Source](https://github.com/googleapis/python-asset/compare/v3.14.1...v3.14.2)

## 🤖 I have created a release *beep* *boop*

#### [3.14.2](https://github.com/googleapis/python-asset/compare/v3.14.1...v3.14.2) (2022-10-10)

##### Bug Fixes

-   **deps:** Allow protobuf 3.19.5 ([#&#8203;508](https://github.com/googleapis/python-asset/issues/508)) ([818abbb](https://github.com/googleapis/python-asset/commit/818abbbcbb829a726d18ba1e7e7e03f997d4256a))

</details>

<details>
<summary>googleapis/python-bigquery</summary>

### [`v3.3.5`](https://github.com/googleapis/python-bigquery/releases/tag/v3.3.5)

[Compare Source](https://github.com/googleapis/python-bigquery/compare/v3.3.3...v3.3.5)

##### Bug Fixes

-   **deps:** Allow protobuf 3.19.5 ([#&#8203;1379](https://github.com/googleapis/python-bigquery/issues/1379)) ([3e4a074](https://github.com/googleapis/python-bigquery/commit/3e4a074a981eb2920c5f9a711c253565d4844858))

</details>

<details>
<summary>googleapis/python-pubsub</summary>

### [`v2.13.9`](https://github.com/googleapis/python-pubsub/releases/tag/v2.13.9)

[Compare Source](https://github.com/googleapis/python-pubsub/compare/v2.13.7...v2.13.9)

##### Bug Fixes

-   **deps:** Allow protobuf 3.19.5 ([#&#8203;801](https://github.com/googleapis/python-pubsub/issues/801)) ([fa23503](https://github.com/googleapis/python-pubsub/commit/fa235033481783c2ec378b2a26b223bdff206461))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-asset).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMzAuMCIsInVwZGF0ZWRJblZlciI6IjMyLjIzMC4wIn0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement. ML
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants