'speech recognition don't recognise my micro

I'm doing a personal assistant with Python, using the 'speech recognition' library, but when i run the app, it doesn't recognise my micro. It doesn't show any error in the console.

import speech_recognition as sr
import pyttsx3

listener = sr.Recognizer()
engine = pyttsx3.init()
engine.runAndWait()

try:
    with sr.microphone() as source:
        print('Listening...') 
        voice = listener.listen(source)
        command = listener.recognize_google(voice)
        command = command.lower()

except:
    print('Error, try again')

Does anyone know how to fix it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source