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

speech_streaming.py got an error on a Raspberry Pi #374

Closed
kotobuki opened this issue Jun 12, 2016 · 5 comments
Closed

speech_streaming.py got an error on a Raspberry Pi #374

kotobuki opened this issue Jun 12, 2016 · 5 comments
Assignees
Labels
help wanted We'd love to have community involvement on this issue. 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@kotobuki
Copy link

I got an error on a Raspberry Pi (Raspberry Pi 2 Model B, Raspbian Jessie May 2016) as follows. I could run the example successfully only once, but fails in many cases due to same error.

$ python speech_streaming.py 
...
Traceback (most recent call last):
  File "speech_streaming.py", line 145, in <module>
    main()
  File "speech_streaming.py", line 137, in main
    service.Recognize(request_stream(stop_audio), DEADLINE_SECS))
  File "speech_streaming.py", line 114, in listen_print_loop
    for resp in recognize_stream:
  File "/usr/local/lib/python2.7/dist-packages/grpc/framework/crust/_control.py", line 415, in next
    raise self._termination.abortion_error
grpc.framework.interfaces.face.face.LocalError: LocalError(code=None, details="None")

I confirmed that the following example works as expected, so the hardware (i.e. a USB microphone) and the PyAudio library seems to be fine.

https://gist.github.com/kotobuki/f8e7ca76186a6b575c9bf1e86bed5eb1

$ pip list
...
gcloud (0.14.0)
google-api-python-client (1.5.1)
googleapis-common-protos (1.1.0)
...
grpc-google-cloud-speech (1.0.4)
grpcio (0.14.0)
...
pyalsaaudio (0.7)
...
PyAudio (0.2.9)
@github-user-72574089
Copy link

github-user-72574089 commented Jun 27, 2016

+1 exact same problem here, except on Ubuntu 14.04. Maybe the python generator returned by service.Recognize(request_stream(stop_audio), DEADLINE_SECS)) has some sort of issue with iteration? Or is this even a normal python generator? Looking through the stub code was not enlightening.

@jerjou
Copy link
Contributor

jerjou commented Jun 27, 2016

Yeah - the stub code isn't great.
Usually when I hit a LocalError, it meant that some exception was being thrown in the background thread - ie the thread that generates RecognizeRequests. Unfortunately there's a bug in grpc that swallows the actual exception, so you'll get a LocalError for all sorts of things that go wrong.

You might try creating a recognize_stream manually and iterating through it, and making sure it's giving you sane objects instead of throwing exceptions :)

@github-user-72574089
Copy link

github-user-72574089 commented Jun 29, 2016

For future reference, When grpcio==0.14.0 was installed (as per the requirements file) the type returned by service.Recognize() is "grpc.framework.crust._control.Rendezvous object".

With grpcio==0.15.0 or grpcio==0.16.0 the type returned is grpc.beta._client_adaptations._Rendezvous object.

Interestingly enough both of these work fine.

edit: In my own code I had forgotten to put parentheses next to the generator function I passed to Recognize. This resulted in the infrastructure attempting to iterate over the function instead of a generator object, which eventually manifested itself in a LocalError.

@theacodes theacodes added bug help wanted We'd love to have community involvement on this issue. labels Jul 1, 2016
@jerjou
Copy link
Contributor

jerjou commented Jul 13, 2016

Filed as grpc/grpc#7367

@jerjou jerjou closed this as completed Jul 13, 2016
@jerjou
Copy link
Contributor

jerjou commented Jul 14, 2016

FTR, grpcio==0.15.0 appears to show the actual error, instead of the LocalError.

@yoshi-automation yoshi-automation added 🚨 This issue needs some love. triage me I really want to be triaged. labels Apr 7, 2020
Sita04 pushed a commit that referenced this issue Feb 7, 2023
* chore: use gapic-generator-python 0.65.1

PiperOrigin-RevId: 441524537

Source-Link: googleapis/googleapis@2a27391

Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab6756a48c89b5bcb9fb73443cb8e55d574f4643
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWI2NzU2YTQ4Yzg5YjViY2I5ZmI3MzQ0M2NiOGU1NWQ1NzRmNDY0MyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We'd love to have community involvement on this issue. 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

5 participants