I am working with pyttsx3 for text-to-speech. I realized that I can use it within a thread (or I am doing something wrong). Do you know why?
Code Example:
from threading import Thread
import pyttsx3
def myfunc():
  engine = pyttsx3.init()
  engine.say("ok")
  engine.runAndWait()
t = Thread(target=myfunc)
t.start()
Error:
 File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "test.py", line 9, in myfunc
    engine.runAndWait() #blocks
  File "/usr/local/lib/python3.6/site-packages/pyttsx3/engine.py", line 188, in runAndWait
    self.proxy.runAndWait()
  File "/usr/local/lib/python3.6/site-packages/pyttsx3/driver.py", line 204, in runAndWait
    self._driver.startLoop()
  File "/usr/local/lib/python3.6/site-packages/pyttsx3/drivers/nsss.py", line 33, in startLoop
    AppHelper.runConsoleEventLoop()
  File "/usr/local/lib/python3.6/site-packages/PyObjCTools/AppHelper.py", line 241, in runConsoleEventLoop
    nextfire = nextfire.earlierDate_(soon)
AttributeError: 'NoneType' object has no attribute 'earlierDate_'
 
     
    