I know the version is outdated, but i need to know what the problem is. If i want to run my script, this error appears.
File "c:/Users/auth/Downloads/JARVIS/JARVIS/jarvis.py", line 319, in <module>
query = takeCommandMic().lower()
File "c:/Users/auth/Downloads/JARVIS/JARVIS/jarvis.py", line 118, in takeCommandMic
with sr.Microphone() as source:
File "C:\Users\auth\AppData\Roaming\Python\Python36\site-packages\speech_recognition\__init__.py", line 141, in __enter__
input=True, # stream is an input stream
File "C:\Users\auth\AppData\Roaming\Python\Python36\site-packages\pyaudio.py", line 750, in open
stream = Stream(self, *args, **kwargs)
File "C:\Users\auth\AppData\Roaming\Python\Python36\site-packages\pyaudio.py", line 441, in __init__
self._stream = pa.open(**arguments)
OSError: [Errno -9999] Unanticipated host error
Error in sys.excepthook:
Original exception was:
The problems should be there:
def takeCommandMic():
r = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
r.pause_threshold = 0.5
audio = r.listen(source)
try:
print("recognizing...")
query = r.recognize_google(audio , language="de-DE")
print(query)
except Exception as e:
print(e)
return "Nichts"
return query
and also there
if __name__ == "__main__":
getvoices(1)
speak("Hallo, hier ist jarvis")
#wishme()
while True:
turnOnLightsAtTime()
query = takeCommandMic().lower()
CodePudding user response:
This would be better suited to a comment, but I do not have the 50 rep required to make one:
It appears you are using the pyaudio
library. According to this question: