Nov-28-2024, 04:12 PM
Every time i try to run the bellow code it gives me back this Error message
(TypeError: argument of type 'NoneType' is not iterable)
can anyone tell me where exactly the problem
(TypeError: argument of type 'NoneType' is not iterable)
can anyone tell me where exactly the problem
import pyttsx3 import speech_recognition as sr import webbrowser import time import datetime import os import subprocess import asyncio from pydub import AudioSegment from pydub.playback import play #import pyautogul wel = pyttsx3.init() voices = wel.getProperty('voices') wel.setProperty('voice', voices[0].id) def Speak(audio): wel.say(audio) wel.runAndWait() def TakeCommands(): command = sr.Recognizer() with sr.Microphone() as mic: print ('say commands sir ..') command.phrase_threshold = 0.4 audio = command.listen(mic) try : print ('Recording ...') query = command.recognize_google(audio, language = 'en') print (f'you said : {query}') except Exception as Error: return None return query.lower() music = AudioSegment.from_mp3('sounds/welcom.mp3') play (music) while True: query = TakeCommands() if 'open phootoshop' in query: b = AudioSegment.from_mp3('sounds/absher.mp3') play(b)