Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python keyerror 'sapi5'

One question of this type is previously asked but is not very helpful. I am using version Python3.6 in Windows 10 OS. I am getting an error, KeyError: 'sapi5' and During handling of the above exception, another exception occurred. My code is:

import pyttsx3
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
print(voices)

And here is the stack trace:

 File "c:/Users/farhe/OneDrive/Desktop/PYTHON/jarvis/ai.py.py", line 2, in <module>
    engine = pyttsx3.init(sapi5)
NameError: name 'sapi5' is not defined

What should I do?

like image 616
Utpal Gaurav Avatar asked Oct 16 '22 14:10

Utpal Gaurav


1 Answers

From the Github README:

If you recieve errors such as No module named win32com.client, No module named win32, or No module named win32api, you will need to additionally install pypiwin32.

like image 169
shriakhilc Avatar answered Oct 21 '22 01:10

shriakhilc