ошибка, при запуске программы на pyttsx3
код:
import pyttsx3
def speak(what):
print(what)
speak_engine = pyttsx3.init()
speak_engine.say(what)
speak_engine.runAndWait()
speak('hello!')
ошибка:
eng = _activeEngines[driverName]
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\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\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in <module>
from comtypes.gen import SpeechLib # comtypes
ImportError: cannot import name 'SpeechLib' from 'comtypes.gen' (C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\gen\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 121, in WINFUNCTYPE
return _win_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.HRESULT'>, (<class 'comtypes.automation.tagVARIANT'>, <class 'ctypes.wintypes.LP_c_long'>), 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:/Users/egor/Desktop/golos.py", line 10, in <module>
talk('hello')
File "c:/Users/egor/Desktop/golos.py", line 6, in talk
says = pyttsx3.init()
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line
127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\drivers\sapi5.py", line 6, in <module>
engine = comtypes.client.CreateObject("SAPI.SpVoice")
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 250, in CreateObject
return _manage(obj, clsid, interface=interface)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 110, in GetBestInterface
mod = GetModule(tlib)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 118, in GetModule
mod = _CreateWrapper(tlib, pathname)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 198, in _CreateWrapper
mod = _my_import(fullname)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 19, in _my_import
return __import__(fullname, globals(), locals(), ['DUMMY'])
866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.py", line 2417, in <module>
( ['out', 'retval'], POINTER(VARIANT), 'NewPosition' )),
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\__init__.py", line 323, in __setattr__
self._make_methods(value)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\__init__.py", line 692, in _make_methods
prototype = WINFUNCTYPE(restype, *argtypes)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 123, in WINFUNCTYPE
class WinFunctionType(_CFuncPtr):
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.
PS C:\Users\egor> & python c:/Users/egor/Desktop/golos.py
Traceback (most recent call last):
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\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\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in <module>
from comtypes.gen import SpeechLib # comtypes
ImportError: cannot import name 'SpeechLib' from 'comtypes.gen' (C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\gen\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 121, in WINFUNCTYPE
return _win_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.HRESULT'>, (<class 'comtypes.automation.tagVARIANT'>, <class 'ctypes.wintypes.LP_c_long'>), 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:/Users/egor/Desktop/golos.py", line 10, in <module>
talk('hello')
File "c:/Users/egor/Desktop/golos.py", line 6, in talk
says = pyttsx3.init()
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line
127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\drivers\sapi5.py", line 6, in <module>
engine = comtypes.client.CreateObject("SAPI.SpVoice")
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 250, in CreateObject
return _manage(obj, clsid, interface=interface)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 110, in GetBestInterface
mod = GetModule(tlib)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 118, in GetModule
mod = _CreateWrapper(tlib, pathname)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 198, in _CreateWrapper
mod = _my_import(fullname)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 19, in _my_import
return __import__(fullname, globals(), locals(), ['DUMMY'])
866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.py", line 1702, in <module>
( ['out', 'retval'], POINTER(VARIANT), 'NewPosition' )),
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\__init__.py", line 323, in __setattr__
self._make_methods(value)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\__init__.py", line 692, in _make_methods
prototype = WINFUNCTYPE(restype, *argtypes)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 123, in WINFUNCTYPE
class WinFunctionType(_CFuncPtr):
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.
PS C:\Users\egor> & python c:/Users/egor/Desktop/golos.py
Traceback (most recent call last):
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\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\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in <module>
from comtypes.gen import SpeechLib # comtypes
ImportError: cannot import name 'SpeechLib' from 'comtypes.gen' (C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\gen\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 121, in WINFUNCTYPE
return _win_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.HRESULT'>, (<class 'comtypes.automation.tagVARIANT'>, <class 'comtypes.LP_POINTER(ISpeechGrammarRule)'>), 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:/Users/egor/Desktop/golos.py", line 2, in <module>
engine = pyttsx3.init()
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line
127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\drivers\sapi5.py", line 6, in <module>
engine = comtypes.client.CreateObject("SAPI.SpVoice")
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 250, in CreateObject
return _manage(obj, clsid, interface=interface)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 110, in GetBestInterface
mod = GetModule(tlib)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 118, in GetModule
mod = _CreateWrapper(tlib, pathname)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 198, in _CreateWrapper
mod = _my_import(fullname)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 19, in _my_import
return __import__(fullname, globals(), locals(), ['DUMMY'])
866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.py", line 326, in <module>
( ['out', 'retval'], POINTER(VARIANT), 'SaveStream' )),
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\__init__.py", line 323, in __setattr__
self._make_methods(value)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\__init__.py", line 692, in _make_methods
prototype = WINFUNCTYPE(restype, *argtypes)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 123, in WINFUNCTYPE
class WinFunctionType(_CFuncPtr):
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.
PS C:\Users\egor> & python c:/Users/egor/Desktop/golos.py
hello!
Traceback (most recent call last):
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\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\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in <module>
from comtypes.gen import SpeechLib # comtypes
ImportError: cannot import name 'SpeechLib' from 'comtypes.gen' (C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\gen\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 121, in WINFUNCTYPE
return _win_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.HRESULT'>, (<class 'comtypes.automation.tagVARIANT'>, <class 'ctypes.wintypes.LP_c_long'>), 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:/Users/egor/Desktop/golos.py", line 9, in <module>
speak('hello!')
File "c:/Users/egor/Desktop/golos.py", line 5, in speak
speak_engine = pyttsx3.init()
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line
127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\pyttsx3\drivers\sapi5.py", line 6, in <module>
engine = comtypes.client.CreateObject("SAPI.SpVoice")
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 250, in CreateObject
return _manage(obj, clsid, interface=interface)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\__init__.py", line 110, in GetBestInterface
mod = GetModule(tlib)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 118, in GetModule
mod = _CreateWrapper(tlib, pathname)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 198, in _CreateWrapper
mod = _my_import(fullname)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\client\_generate.py", line 19, in _my_import
return __import__(fullname, globals(), locals(), ['DUMMY'])
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\gen\_C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.py", line 75, in <module>
( ['out', 'retval'], POINTER(VARIANT), 'NewPosition' )),
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\__init__.py", line 323, in __setattr__
self._make_methods(value)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\site-packages\comtypes\__init__.py", line 692, in _make_methods
prototype = WINFUNCTYPE(restype, *argtypes)
File "C:\Users\egor\AppData\Local\Programs\Python\Python37\lib\ctypes\__init__.py", line 123, in WINFUNCTYPE
class WinFunctionType(_CFuncPtr):
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.