Dec-05-2018, 08:37 PM
i'm using pyttsx3 on a raspberry pi running raspbian which is debian linux to read out the current time and date. this is a simple test of the module before i try implementing reading out a timer in a larger project but i'm already running into a curious issue. when i run the py file the voice is cut off partway through when it starts reading the minutes. the exact same lines copied into the interactive python shell run fine. I am running from bash and have no gui. why does it work one way but not the other? and how do i get it to read properly. the py file is below
import datetime import pyttsx3 now=datetime.datetime.now() datestring= "The Current time is " + str(now.hour) + " " +str(now.minute) + \ " and " + str(now.second) + " seconds on " + str(now.month) + \ " " + str(now.day) + " " + str(now.year) engine=pyttsx3.init() engine.setProperty('rate',100) engine.setProperty('volume',1) engine.say(datestring) engine.runAndWait() print(datestring)