Cannot change the voice in pyttsx3??
Everytime i try to change the voice (and just try to GET the voices) it gives me an error.
import pyttsx3
engine = pyttsx3.init()
voices = engine.getProperty('voices')
for voice in voices:
engine.setProperty('voice', voice.id)
engine.say('The quick brown fox jumped over the lazy dog.')
engine.runAndWait()
Error:
Traceback (most recent call last):
File "c:\Users\####\Desktop\New Game Cuz Im Bored\import pyttsx3.py", line 3, in <module>
voices = engine.getProperty('voices')
File "C:\Users\####\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyttsx3\engine.py", line 187, in getProperty
return self.proxy.getProperty(name)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "C:\Users\####\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyttsx3\driver.py", line 165, in getProperty
return self._driver.getProperty(name)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "C:\Users\####\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyttsx3\drivers\sapi5.py", line 133, in getProperty
return [self._toVoice(attr) for attr in self._tts.GetVoices()]
~~~~~~~~~~~~~^^^^^^
File "C:\Users\####\AppData\Local\Programs\Python\Python313\Lib\site-packages\pyttsx3\drivers\sapi5.py", line 107, in _toVoice
language_code = int(language_attr, 16)
ValueError: invalid literal for int() with base 16: '409;9'
Posted Nov 1, 2025, 1:19 PM UTC
42