2

I'm implementing a simple program for Text-to-speech conversion using the python library pyttsx. It's working fine and uttering all given text as expected but after completion of execution it's not returning to terminal prompt. It is also returning None as name parameter from methods.

The following is the code of the python script.

#!/usr/local/bin/python

import pyttsx
engine = pyttsx.init()
def onStart(name):
    print 'Starting', name
def onWord(name, location, length):
    print 'word', name, location, length
def onEnd(name, completed):
    print 'finishing', name, completed
    engine.stop()

engine.connect('started-utterance', onStart)
engine.connect('started-word', onWord)
engine.connect('finished-utterance', onEnd)
engine.say('The quick brown fox jumped over the lazy dog')
engine.runAndWait()

Output screenshot

enter image description here

jhoepken
  • 1,842
  • 3
  • 17
  • 24
  • The code provided seems to terminate properly for me. I have had issues where it does NOT terminate properly though. Makes me think that it's an error in the shared library pyttsx uses. – shark3y Aug 21 '16 at 22:24

0 Answers0