ProgrammingHero1 / romantic-alexa

397 stars 525 forks source link

Runtime error with pyttsx3 #118

Open Manavmahilang opened 2 years ago

Manavmahilang commented 2 years ago

PS C:\Users\manav\OneDrive\Desktop\My projects\Voice_assistant> & C:/Users/manav/AppData/Local/Microsoft/WindowsApps/python3.10.exe "c:/Users/manav/OneDrive/Desktop/My projects/Voice_assistant/main.py" Traceback (most recent call last): File "C:\Users\manav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyttsx3__init__.py", line 20, in init eng = _activeEngines[driverName] File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64qbz5n2kfra8p0\lib\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 "c:\Users\manav\OneDrive\Desktop\My projects\Voice_assistant\main.py", line 9, in engine = pyttsx3.init() File "C:\Users\manav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyttsx3__init.py", line 22, in init eng = Engine(driverName, debug) File "C:\Users\manav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyttsx3\engine.py", line 30, in init self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug) File "C:\Users\manav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyttsx3\driver.py", line 52, in init self._driver = self._module.buildDriver(weakref.proxy(self)) File "C:\Users\manav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyttsx3\drivers\sapi5.py", line 30, in buildDriver return SAPI5Driver(proxy) File "C:\Users\manav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pyttsx3\drivers\sapi5.py", line 35, in init self._tts = comtypes.client.CreateObject('SAPI.SPVoice') File "C:\Users\manav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\comtypes\client\init.py", line 250, in CreateObject return _manage(obj, clsid, interface=interface) File "C:\Users\manav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\comtypes\client\init.py", line 188, in _manage obj = GetBestInterface(obj) File "C:\Users\manav\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\comtypes\client\init__.py", line 112, in GetBestInterface interface = getattr(mod, itf_name) AttributeError: module 'comtypes.gen.SpeechLib' has no attribute 'ISpeechVoice'

This is the error i get when i run the program . i have tried to resolve it by reinstalling pyttsx3 it does not work . i came a solution which said it is an issue with comtypes so i tried to update it still it did not work.