I'm trying to make a virtual assistant, right now it's suppost to just write down what I say. However when I try to test it it returns,
Traceback (most recent call last): File "/Users/danieldossantos/Desktop/jarvis/chats/main.py", line 14, in speech = r.recognize_google(audio, language = 'pt') File "/Library/Python/2.7/site-packages/speech_recognition/init.py", line 858, in recognize_google if not isinstance(actual_result, dict) or len(actual_result.get("alternative", [])) == 0: raise UnknownValueError() speech_recognition.UnknownValueError
I've checked my code and I haven't found any errors, at least not that I know of,
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as s:
r.adjust_for_ambient_noise(s)
while True:
audio = r.listen(s)
speech = r.recognize_google(audio, language = 'pt')
print('Você disse: ', speech)
r.recognize_google(audio)??? i got the same error too.