Python Forum

Full Version: Not getting response from pyaudio
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am not able to communicate using the laptop microphone

Here is my code
import smtplib # Simple Mail Transfer Protocol
import pyaudio
import speech_recognition as sr  # Speech Recognition
listener = sr.Recognizer()

with sr.Microphone() as source:
        print('listening.......')
        voice = listener.listen(source)
        info = listener.recognize_google(voice)
        print(info)
Here is the error


Error:
Traceback (most recent call last): File "h:\CODE\Py_EmailBot\Email_Bot.py", line 11, in <module> with sr.Microphone() as source: File "C:\Users\Python\AppData\Local\Programs\Python\Python39\lib\site-packages\speech_recognition\__init__.py", line 138, in __enter__ self.audio.open( File "C:\Users\Python\AppData\Local\Programs\Python\Python39\lib\site-packages\pyaudio.py", line 750, in open stream = Stream(self, *args, **kwargs) File "C:\Users\Python\AppData\Local\Programs\Python\Python39\lib\site-packages\pyaudio.py", line 441, in __init__ self._stream = pa.open(**arguments) OSError: [Errno -9999] Unanticipated host error
I am using a Lenovo Thinkpad T440S
I got to know that i needed to "Allow apps to access your microphone" set to ON windows 10 Microphone privacy settings.

Resolved