Open NasaHari opened 4 years ago
I am getting a similar error.
Traceback (most recent call last): File "E:\Software\sarina-env\lib\site-packages\pyttsx3__init__.py", line 20, in init eng = _activeEngines[driverName] File "E:\Software\sarina-env\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 "E:\Software\sarina-env\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "e:/Software/sarina-env/sarina/sarina.py", line 14, in
I also go this error, reverted to version 2.71 and the problem went away.
Does this error occur on the latest build ( v2.84 ) ?
no, in all versions use comtypes
I am getting same type of error . Please solve it soon.
L'erreur peut provenir du fait que vous avez nommé votre fichier Python pyttsx3.py, ce qui peut causer des conflits avec l'importation de la bibliothèque pyttsx3 dans votre fichier. Pour éviter ce genre de conflits, il est recommandé de ne pas nommer vos fichiers avec le même nom que les bibliothèques Python que vous utilisez. Pour résoudre ce problème, vous pouvez renommer votre fichier Python en utilisant un autre nom, puis exécuter à nouveau votre code. Cela devrait vous permettre d'initialiser la bibliothèque pyttsx3 sans erreurs.
Traceback (most recent call last): File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\pyttsx3__init__.py", line 20, in init eng = _activeEngines[driverName] File "C:\Users\kvvinod\AppData\Local\Programs\Python\Python38-32\lib\weakref.py", line 131, in getitem o = self.data[key]() KeyError: 'sapi5'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in
from comtypes.gen import SpeechLib # comtypes
ImportError: cannot import name 'SpeechLib' from 'comtypes.gen' (C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\comtypes\gen__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\kvvinod\AppData\Local\Programs\Python\Python38-32\lib\ctypes__init__.py", line 123, in WINFUNCTYPE return _win_functype_cache[(restype, argtypes, flags)] KeyError: (<class 'ctypes.HRESULT'>, (<class 'comtypes.automation.tagVARIANT'>, <class 'comtypes.LP_POINTER(ISpeechRecoGrammar)'>), 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:/Users/kvvinod/PycharmProjects/textToSpeech/venv/app.py", line 2, in
engine = pyttsx3.init('sapi5')
File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\pyttsx3__init.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\pyttsx3\engine.py", line 30, in init
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\pyttsx3\driver.py", line 50, in init
self._module = importlib.import_module(name)
File "C:\Users\kvvinod\AppData\Local\Programs\Python\Python38-32\lib\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 "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\pyttsx3\drivers\sapi5.py", line 6, in
engine = comtypes.client.CreateObject("SAPI.SpVoice")
File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\comtypes\client__init__.py", line 250, in CreateObject
return _manage(obj, clsid, interface=interface)
File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\comtypes\client__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\comtypes\client\ init__.py", line 110, in GetBestInterface
mod = GetModule(tlib)
File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\comtypes\client_generate.py", line 110, in GetModule
mod = _CreateWrapper(tlib, pathname)
File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\comtypes\client_generate.py", line 184, in _CreateWrapper
mod = _my_import(fullname)
File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\comtypes\client_generate.py", line 24, in _my_import
return import(fullname, globals(), locals(), ['DUMMY'])
File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\comtypes\gen_C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.py", line 937, in
ISpeechRecoContext.methods = [
File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\comtypes\ init.py", line 329, in setattr
self._make_methods(value)
File "C:\Users\kvvinod\PycharmProjects\textToSpeech\venv\lib\site-packages\comtypes\init.py", line 698, in _make_methods
prototype = WINFUNCTYPE(restype, *argtypes)
File "C:\Users\kvvinod\AppData\Local\Programs\Python\Python38-32\lib\ctypes\init__.py", line 125, in WINFUNCTYPE
class WinFunctionType(_CFuncPtr):
TypeError: item 1 in argtypes passes a union by value, which is unsupported.