THIS IS THE PIECE OF CODE:-
def takecommand():
    r=sr.Recognizer()
    with sr.Microphone as source:
        r.pause_threshold=1
        r.energy_threshold=320
        audio = r.listen(source)
THIS IS THE ERROR COMING:-
File "c:/Users/user/Desktop/jarvis/jarvis.py", line 28, in takecommand
    with sr.Microphone as source:
AttributeError: __enter__
PLEASE HELP ME OUT WITH THIS ERROR IT WILL OF GREAT HELP.IF MIRE CODE IS NEEDED I AM READY TO GIVE .