pyaudio OSError: [Errno - 9999] Unanticipated host error
Asked Answered
M

4

0

I'm trying to use the microphone of my webcam logitech to listen

with sr.Microphone(sample_rate=32000) as source:
...

This error occurs :

File "/home/pi/project2/interface.py", line 226, in listen with sr.Microphone(sample_rate = 32000) as source: File "/usr/local/lib/python3.4/dist-packages/speech_recognition/init.py", line 140, in enter input=True, # stream is an input stream File "/usr/local/lib/python3.4/dist-packages/PyAudio-0.2.10-py3.4-linux-armv7l.egg/pyaudio.py", line 750, in open stream = Stream(self, *args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/PyAudio-0.2.10-py3.4-linux-armv7l.egg/pyaudio.py", line 441, in init self._stream = pa.open(**arguments) OSError: [Errno -9999] Unanticipated host error

I didn't find any fitting information on the web

Mezzo answered 8/5, 2017 at 6:42 Comment(3)
The error message is incomplete, you should report this as an issue at github.com/Uberi/speech_recognition/issues.Damara
Duplicate of #41519405Exodontics
Also #41519405Exodontics
D
0

You may check your anti-virus SW. I got the same problem "OSError: [Errno - 9999] Unanticipated host error" every time I tried to record the wave file by pyAudio. I check and confirm all the parameters OK. I was stuck for several days before I noticed the anti-virus on my PC block my python script call to the hardware level.

All the thing I need to do is disable or exit the anti-virus SW and everything work well again.

Dymoke answered 18/7, 2019 at 2:12 Comment(0)
O
0

I got this error while working with python threads.

I was creating 2 pyaudio objects for different purposes and hadn't closed one of them later. This gave me the error:

[Errno - 9999] Unanticipated host error

Closing that thread fixed my issue.

Orle answered 23/4, 2020 at 10:44 Comment(0)
C
0

It may be a problem with microphone permission for your app make sure you have enabled the microphone permission for all apps in settings. because have developed one Tkinter project in which I am using pyaudio for recording purpose. On my pc the recorder working fine but not on the client machine. after investigation and running the same script on client machin it gives the same error as you mention. but after giving permission of a microphone for my project it working fine. pyaudio throws this error because the python script not able to use the mic hardware. I hope you will get some clarity with this and my answer may help you.

Corwin answered 12/3, 2021 at 16:25 Comment(0)
R
0

Windows user here. For me, I just had to change the default microphone which was being changed every time I connected my headphones.

This might also happen if there is no microphone access to the program or the microphone is not working properly. To check if the microphone is working properly, try recording some audio in voice recorder, and see if the selected microphone is the default audio recording device.

Reputed answered 17/4, 2021 at 11:15 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.