nateshmbhat / pyttsx3

Offline Text To Speech synthesis for python
Mozilla Public License 2.0
2.07k stars 327 forks source link

error in execution #58

Closed rpotter12 closed 5 years ago

rpotter12 commented 5 years ago

The result for the code:

import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()

is

Traceback (most recent call last): File "/home/rohit/Desktop/assistant/venv/lib/python3.6/site-packages/pyttsx3/init.py", line 20, in init eng = _activeEngines[driverName] File "/usr/local/lib/python3.6/weakref.py", line 137, in getitem o = self.data[key]() KeyError: None During handling of the above exception, another exception occurred: Traceback (most recent call last): File "speechtotext.py", line 2, in engine = pyttsx3.init() File "/home/rohit/Desktop/assistant/venv/lib/python3.6/site-packages/pyttsx3/init.py", line 22, in init eng = Engine(driverName, debug) File "/home/rohit/Desktop/assistant/venv/lib/python3.6/site-packages/pyttsx3/engine.py", line 30, in init self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug) File "/home/rohit/Desktop/assistant/venv/lib/python3.6/site-packages/pyttsx3/driver.py", line 50, in init self._module = importlib.import_module(name) File "/usr/local/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/home/rohit/Desktop/assistant/venv/lib/python3.6/site-packages/pyttsx3/drivers/espeak.py", line 5, in from . import _espeak, toUtf8, fromUtf8 File "/home/rohit/Desktop/assistant/venv/lib/python3.6/site-packages/pyttsx3/drivers/_espeak.py", line 18, in dll = cdll.LoadLibrary('libespeak.so.1') File "/usr/local/lib/python3.6/ctypes/init.py", line 426, in LoadLibrary return self._dlltype(name) File "/usr/local/lib/python3.6/ctypes/init.py", line 348, in init self._handle = _dlopen(self._name, mode) OSError: libespeak.so.1: cannot open shared object file: No such file or directory

Why this error is comming?

rpotter12 commented 5 years ago

I have solved this. I was having the multiple version of python. So it was not running.