Hi,
I hope you can help, please see error stack below:
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pyttsx3/__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "/data/data/com.termux/files/usr/lib/python3.9/weakref.py", line 134, in __getitem__
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/storage/emulated/0/Documents/tts_offline.py", line 4, in
engine = pyttsx3.init()
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pyttsx3/init.py", line 22, in init
eng = Engine(driverName, debug)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pyttsx3/engine.py", line 30, in init
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pyttsx3/driver.py", line 50, in init
self._module = importlib.import_module(name)
File "/data/data/com.termux/files/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pyttsx3/drivers/espeak.py", line 9, in
from . import _espeak, toUtf8, fromUtf8
File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/pyttsx3/drivers/_espeak.py", line 18, in
dll = cdll.LoadLibrary('libespeak.so.1')
File "/data/data/com.termux/files/usr/lib/python3.9/ctypes/init.py", line 452, in LoadLibrary
return self._dlltype(name)
File "/data/data/com.termux/files/usr/lib/python3.9/ctypes/init.py", line 374, in init
self._handle = _dlopen(self._name, mode)
OSError: dlopen failed: library "libespeak.so.1" not found
Due to some limitations of Termux, it doesn't work.
The problem does not lie in your system or pyttsx3 itself.