I ahve the following python code:
import speech_recognition as sr
recognizer=sr.Recognizer()
mic=sr.Microphone()
print('Heyyyaa')
audio=recognizer.listen(mic)
try:
text=recognizer.recognize_google(language='it')
print('heyyya '+text)
except sr.UnknownValueError:
print('Errore 1')
except sr.RequestError:
print('Errore 2')
I get the following error:
Traceback (most recent call last):
File "C:/Users/Freddy/PycharmProjects/SpeechRecognition/SpeechToText.py", line 26, in <module>
audio=recognizer.listen(mic)
File "C:\Python34\lib\site-packages\speech_recognition\__init__.py", line 293, in listen
buffer = source.stream.read(source.CHUNK)
AttributeError: 'NoneType' object has no attribute 'read'