Trying to build an AI and everything was working until I try to call date()
. Am I calling it correctly? Thank you greatly for your help
import pyttsx3
import datetime
engine = pyttsx3.init()
def speak(audio):
engine.say(audio)
engine.runAndWait()
def time():
Time = datetime.datetime.now().strftime("%I:%M:%S")
speak(Time)
def date():
year = int(datetime.datetime.now().year)
month = int(datetime.datetime.now().month)
date = int(datetime.datetime.now().day)
speak(date)
speak(month)
speak(year)
date()
Error
2021-10-06 00:17:55.153 python[29408:516608] -[OC_BuiltinPythonNumber length]: unrecognized selector sent to instance 0x7fab3f721d20
^CTraceback (most recent call last):
File "Jarvis.py", line 21, in <module>
date()
File "Jarvis.py", line 18, in date
speak(date)
File "Jarvis.py", line 8, in speak
engine.runAndWait()
File "/opt/anaconda3/lib/python3.8/site-packages/pyttsx3/engine.py", line 180, in runAndWait
self.proxy.runAndWait()
File "/opt/anaconda3/lib/python3.8/site-packages/pyttsx3/driver.py", line 192, in runAndWait
self._driver.startLoop()
File "/opt/anaconda3/lib/python3.8/site-packages/pyttsx3/drivers/nsss.py", line 35, in startLoop
AppHelper.runConsoleEventLoop()
File "/opt/anaconda3/lib/python3.8/site-packages/PyObjCTools/AppHelper.py", line 263, in runConsoleEventLoop
if not runLoop.runMode_beforeDate_(mode, nextfire):
KeyboardInterrupt
It hangs at first so I have to use exit with control c