pythoncomtext-to-speechpyttsx3

Why does pyttsx3 return a COMError when getting a voice description after I changed the voice registry?


Traceback (most recent call last):
  File "c:\Users\Compu Tech\OneDrive\Desktop\Cortex\tempCodeRunnerFile.python", line 3, in <module>
    voices = engine.getProperty('voices')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Compu Tech\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyttsx3\engine.py", line 146, in getProperty
    return self.proxy.getProperty(name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Compu Tech\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyttsx3\driver.py", line 173, in getProperty
    return self._driver.getProperty(name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Compu Tech\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyttsx3\drivers\sapi5.py", line 88, in getProperty
    return [self._toVoice(attr) for attr in self._tts.GetVoices()]
            ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Compu Tech\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyttsx3\drivers\sapi5.py", line 77, in _toVoice   
    return Voice(attr.Id, attr.GetDescription())
                          ^^^^^^^^^^^^^^^^^^^^^
_ctypes.COMError: (-2147200966, None, (None, None, None, 0, None))

This error happened after I changed the voice registry, and now I can't use the module. I have already tried reinstalling the module.


Solution

  • To solve this problem there are two ways

    1. use widows Windows restore point to back or undo the changes you have been done in the registry file

    2. if have a backup for the registry file it will be great if you will restore the backup so the issue will go away

    Before you make any changes in system files don't forget to take a backup