So basically I am building a python virtual assistant software in a virtual environment and I want to use pyttsx3 to convert text to speech. The first issue is that if i run pyttsx3.init() I get an error
o = self.data[key]()
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".\__init__.py", line 3, in <module>
init_speech()
File "C:\Users\DJETHA\eclipse-workspace\PythonFull\PythonProjects\Betax\index.py", line 31, in init_speech
engine = pyttsx3.init()
File "C:\Users\DJETHA\eclipse-workspace\PythonFull\PythonProjects\Betax\venv\lib\site-packages\pyttsx3\__init__.py", line 46, in init
eng = Engine(driverName, debug)
File "C:\Users\DJETHA\eclipse-workspace\PythonFull\PythonProjects\Betax\venv\lib\site-packages\pyttsx3\engine.py", line 52, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\DJETHA\eclipse-workspace\PythonFull\PythonProjects\Betax\venv\lib\site-packages\pyttsx3\driver.py", line 75, in __init__
self._module = importlib.import_module(name)
File "C:\Users\DJETHA\eclipse-workspace\PythonFull\PythonProjects\Betax\venv\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\DJETHA\eclipse-workspace\PythonFull\PythonProjects\Betax\venv\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in <module>
import win32com.client
File "C:\Users\DJETHA\eclipse-workspace\PythonFull\PythonProjects\Betax\venv\lib\site-packages\win32com\__init__.py", line 5, in <module>
import win32api, sys, os
Upon doing my research I found out that using pyttsx3.init("dummy") wont generate any error. The next issue though is that when I run
engine =pyttsx3.init("dummy")
engine.say("hey")
engine.runAndWait()
I dont hear anything or see any error
I should note that if i used the above code without the dummy in the pyttsx3.init outside the virtual env, everything works fine.