I have initialized everything (audio, time, etc...). But when I used time, I heard no sound.
How can I fix it?
import pyttsx3
import datetime
friday = pyttsx3.init()
voice = friday.getProperty("voices")
friday.setProperty('voice', voice[1].id)
def speak(audio):
friday.say(audio)
friday.runAndWait()
def time():
Time = datetime.datetime.now().strftime('%I:%M:%p')
speak(time)
time()
CodePudding user response:
I think you have made a small mistake in naming variables.
def time():
Time = datetime.datetime.now().strftime('%I:%M:%p')
speak(time)
Aren't they supposed to be the same variable.