I suppose this is only meant to work on Windows?
I had this issue on Ubuntu 20.04
Loading your AI personal assistant - G One
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pyttsx3/init.py", line 20, in init
eng = _activeEngines[driverName]
File "/usr/lib/python3.8/weakref.py", line 131, in getitem
o = self.datakey
KeyError: 'sapi5'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "firstaitest.py", line 17, in
engine=pyttsx3.init('sapi5')
File "/usr/local/lib/python3.8/dist-packages/pyttsx3/init.py", line 22, in init
eng = Engine(driverName, debug)
File "/usr/local/lib/python3.8/dist-packages/pyttsx3/engine.py", line 30, in init
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "/usr/local/lib/python3.8/dist-packages/pyttsx3/driver.py", line 50, in init
self._module = importlib.import_module(name)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 783, in exec_module
File "", line 219, in _call_with_frames_removed
File "/usr/local/lib/python3.8/dist-packages/pyttsx3/drivers/sapi5.py", line 1, in
import comtypes.client # Importing comtypes.client will make the gen subpackage
File "/usr/local/lib/python3.8/dist-packages/comtypes/init.py", line 23, in
from _ctypes import COMError
ImportError: cannot import name 'COMError' from '_ctypes' (/usr/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so)