Za Ion
Za Ion

Reputation: 11

Sapi voice PAUSING error : pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147201018), None)

I just wnat to make an app that tts(convert text to speech) text so i found Sapi voice is a good lib for this. It works well when I run the 'start_speacking' function in a thread. BUT, when I pause the speaker and wait for about 5-15 seconds I get this error below...

pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147201018), None)
import threading
import time
import win32com.client
import pythoncom


speaker = win32com.client.Dispatch("SAPI.SpVoice")


def start_speaking():

    global speaker

    pythoncom.CoInitialize()
    speaker.Speak('hello world hello world hello world')




thread = threading.Thread(target=start_speaking)
thread.start()
time.sleep(1)
speaker.Pause()

Upvotes: 1

Views: 301

Answers (0)

Related Questions