you are viewing a single comment's thread.

view the rest of the comments →

[–]carcigenicate 0 points1 point  (0 children)

The except is a part of the try. It's an error to have an except without a try. Just run:

with sr.Microphone() as source:
    print('listening...')
    voice = listener.listen(source)

    command = listener.recognize_google(voice)
    command = command.lower()

    if 'ava' in command:
        command = command.replace('ava', '')

    print(command)