Traceback (most recent call last):
File "C:/Users/orfao/PycharmProjects/jarvis2/Main.py", line 35, in <module>
speak("Initializing Jarvis...")
File "C:/Users/orfao/PycharmProjects/jarvis2/Main.py", line 18, in speak
engine.runAndWait()
File "C:\Users\orfao\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\engine.py", line 180, in runAndWait
self.proxy.runAndWait()
File "C:\Users\orfao\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\driver.py", line 192, in runAndWait
self._driver.startLoop()
File "C:\Users\orfao\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 127, in startLoop
pythoncom.PumpWaitingMessages()
NameError: name 'pythoncom' is not defined
the code i am using is the following
import pyttsx3
import speech_recognition as sr
import datetime
import wikipedia
import os
import smtplib
print("Initializing Jarvis")
MASTER = "Miguel"
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
def speak(text):
engine.say(text)
engine.runAndWait()
def wishMe():
hour = int(datetime.datetime.now().hour)
print(hour)
if hour>=0 and hour<12:
speak("Good Morning" + MASTER)
elif hour>=12 and hour<18:
speak("Good Afternoon" + MASTER)
else:
speak("Good Evening" + MASTER)
speak("Initializing Jarvis...")
wishMe()