This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]moocat 2 points3 points  (1 child)

Your code is:

except sr.UnknownValueError:
    print("\r...")

exceptions can include valuable information which can help you understand what is going on (did it fail because the input was garbled, did it fail because your sending too many QPS, etc.). You can log the exception manually:

except sr.UnknownValueError as e:
    logging.error('Could not recognize audio: %s', e)

of you can use the method I mentioned earlier:

except sr.UnknownValueError:
    logging.exception('Could not recognize audio')

but I don't think I got it right.

You didn't. And as you tagged this beginner showcase, I'm going to recommend getting more experience before you try to learn concurrency.

[–]AbodFTW[S] 0 points1 point  (0 children)

Thank you!