python-docs-samples icon indicating copy to clipboard operation
python-docs-samples copied to clipboard

StreamingRecognize() throws TypeError.

Open BhargavSatya opened this issue 6 years ago • 1 comments

In which file did you encounter the issue?

https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/speech/microphone/transcribe_streaming_mic.py

Did you change the file? If so, how?

No. But using the same but trimmed version of .proto file which uses a GCP server. This should not matter anyhow. A connection call is not made . The error comes before it makes a call to the server.

Describe the issue

I am trying to run the application, using the similar .proto file which uses a GCP server. But it gives me the following error. I am not able to point why the errors is coming. I cannot specify the timeout in '_StreamStreamMultiCallable' class. The timeout object is somehow 'generator' type and not time.time() type. Where can i specify this?

Traceback (most recent call last): File "transcribe_streaming_mic.py", line 193, in main() File "transcribe_streaming_mic.py", line 162, in main responses = client.StreamingRecognize(streaming_config, requests) File "/Users/user/.virtualenvs/grpc/lib/python3.7/site-packages/grpc/_channel.py", line 1065, in call deadline = _deadline(timeout) File "/Users/user/.virtualenvs/grpc/lib/python3.7/site-packages/grpc/_channel.py", line 85, in _deadline return None if timeout is None else time.time() + timeout TypeError: unsupported operand type(s) for +: 'float' and 'generator'

BhargavSatya avatar Apr 13 '20 10:04 BhargavSatya

My bad. The API i was using was not of GCloud. Although it was similar. Got the solution now.

BhargavSatya avatar Apr 13 '20 11:04 BhargavSatya