speech_recognition icon indicating copy to clipboard operation
speech_recognition copied to clipboard

error

Open harshgupta9803 opened this issue 4 years ago • 1 comments

def takecommand(): # audio input r = sr.Recognizer() with sr.Microphone() as source: print("Listening...") r.pause_threshold = 1 audio = r.listen(source)

try:
    print("Recognizing...")
    query = r.recognize_google(audio , Language='en-in')
    print(f"User: said: , {query}\n")   

except Exception as e:
    print("say that again plese...")
    return "None"
return query

harshgupta9803 avatar Jan 08 '21 11:01 harshgupta9803

def takecommand():

audio input

r = sr.Recognizer() with sr.Microphone() as source: print("Listening...") r.pause_threshold = 1 audio = r.listen(source)

try:
    print("Recognizing...")
    query = r.recognize_google(audio , Language='en-in')
    print(f"User: said: , {query}\n")   

except Exception as e:
    print("say that again plese...")
    return "None"
return query

Traceback (most recent call last): File "e:/python/Darwin.py", line 50, in takecommand() File "e:/python/Darwin.py", line 32, in takecommand with sr.Microphone() as source: File "C:\Users\harsh\AppData\Local\Programs\Python\Python37\lib\site-packages\speech_recognition_init_.py", line 141, in enter input=True, # stream is an input stream File "C:\Users\harsh\AppData\Local\Programs\Python\Python37\lib\site-packages\pyaudio.py", line 750, in open stream = Stream(self, *args, **kwargs) File "C:\Users\harsh\AppData\Local\Programs\Python\Python37\lib\site-packages\pyaudio.py", line 441, in init self._stream = pa.open(**arguments) OSError: [Errno -9999] Unanticipated host error

harshgupta9803 avatar Jan 08 '21 11:01 harshgupta9803