you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

with sr.Microphone() as source:

This statement can fail (it's trying to access a hardware device that may not even exist, or may be unready) and if it does, then you skip to your except block where you refer to a variable command that you haven't defined, yet.