Ошибка при запуске кода на Python pyttsx3

Есть код:

import pyttsx3

ttsx = pyttsx3.init()
ru_voice_id = "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Speech/Voices/Tokens/TTS_MS_RU-RU_IRINA_11.0"
ttsx.setProperty('voice', ru_voice_id)

microphone = speech_recognition.Microphone()
recognizer = speech_recognition.Recognizer()


def talk(phrase_to_talk):
    ttsx.say(phrase_to_talk)
    ttsx.runAndWait()


talk("Привет, мир!")

Когда запускаю, ошибка:

Traceback (most recent call last):
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 20, in init
    eng = _activeEngines[driverName]
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\weakref.py", line 131, 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\andre\Desktop\Ilona\main.py", line 4, in <module>
    ttsx = pyttsx3.init()
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 22, in init
    eng = Engine(driverName, debug)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\driver.py", line 52, in __init__
    self._driver = self._module.buildDriver(weakref.proxy(self))
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 30, in buildDriver
    return SAPI5Driver(proxy)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 47, in __init__
    self.setProperty('voice', self.getProperty('voice'))
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 100, in setProperty
    token = self._tokenFromId(value)
  File "C:\Users\andre\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 80, in _tokenFromId
    tokens = self._tts.GetVoices()
_ctypes.COMError: (-2147200967, None, (None, None, None, 0, None))

Что делать?


Ответы (0 шт):