Python text to speech not working using pyttsx3

Viewed 200
import pyttsx3
engine=pyttsx3.init('dummy')
engine.say('Hello')
engine.runAndWait()

While I am executing the following code, I am not getting any errors but I am not getting any voice from the system.Help me what I want to do.

2 Answers

This should work:

import pyttsx3
engine = pyttsx3.init()
engine.say("Hello")
engine.runAndWait()

Actually 'dummy' is a test driver that does not do anything. Try using 'sapi5' or leave it empty.
import pyttsx3 engine=pyttsx3.init('sapi5')

(or)

import pyttsx3 engine=pyttsx3.init()

Hope it works!

Related