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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
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) |