'I get this error when using Speech Recognition with my Raspberry pi 400 in Python

I'm trying to use the Speech Recognition library for a school project but it gives me a massive error when I try to use it. When I try to run the following code:

def getMic():
r = sr.Recognizer()
with sr.Microphone as source:
    audioData = r.listen(source)                                              
    try:
        words = parent.r.recognize_google(audioData)                                 
    except:
        return 'asdsafdfa'
    return words.lower()

When trying to run this, I get this https://pastebin.com/iDmkugFK

I don't know how to fix this. If someone can or has an alternate library I can use, that would be great.



Sources

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

Source: Stack Overflow

Solution Source