I have a password recognition code that goes like this:
from wit import Wit
import pyttsx3, time
def speak(string):
engine = pyttsx3.init()
engine.setProperty('rate', 220)
engine.say(string)
engine.runAndWait()
def Hear():
recog = sr.Recognizer()
with sr.Microphone() as source:
audio= recog.listen(source)
print (audio)
return
wit_key = 'FO7EYTKK6OHRSZ3A5UFPMZOC7VIXCVSY'
try:
print('VEXD THINKS YOU SAID '+ recog.recognize_wit(audio, key=wit_key))
heard = recog.recognize_wit(audio, key=wit_key)
except sr.UnknownValueError:
print("I DIDN't get that")
except sr.RequestError as e:
print("SERVER DISCONECTED")
speak("CHECKING IDENTITY" )
sound = Hear()
time.sleep(1)
if "master"in sound:
speak("Yes My Lord")
It is supposed to say YEs my lord when I say master but when I say master , it returns this error
File "c:/Users/tdmfa/OneDrive/Desktop/VEXD app/VEXD AI/AI_START.py", line 33, in <module>
if "master"in sound:
TypeError: argument of type 'NoneType' is not iterable