При попытке запуска кода выводит ошибку :
File "c:/Users/User/Desktop/Обучение/Проекты Python/ПРОЕКТЫ ЗАДАНИЙ/Всё голосовое/main.py", line 26, in <module>
audio = r.listen(sourse)
File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\speech_recognition\__init__.py", line 594, in listen
assert source.stream is not None, "Audio source must be entered before listening, see documentation for ``AudioSource``; are you using ``source`` outside of a ``with`` statement?"
AssertionError: Audio source must be entered before listening, see documentation for ``AudioSource``; are you using ``source`` outside of a ``with`` statement?
Код:
import os
import time
import speech_recognition as sr
import pyttsx3
from fuzzywuzzy import fuzz
import datetime
engine = pyttsx3.init()
r = sr.Recognizer()
m = sr.Microphone(device_index= 1)
with m as sourse:
r.adjust_for_ambient_noise(sourse)
audio = r.listen(sourse)
. . .
После троеточия идёт правильный заканчивающий код, проверил