Error using pyttsx3 is a text-to-speech conversion library in Python
pyttsx3 is a text-to-speech conversion library in Python. Unlike alternative libraries, it works offline, and is compatible with both Python 2 and 3.
import pyttsx3
engine = pyttsx3.init()
It shows errors:
Traceback (most recent call last):
File "C:\Users\MyName\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\MyName\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:
...
If running into this type of error for this pip library, you can uninstall the current version and downgrade the library, using these commands:
pip uninstall pyttsx3 pip install pyttsx3==2.71
You’ll see this notification in the console:
Collecting pyttsx3==2.71 Downloading pyttsx3-2.71-py3-none-any.whl (39 kB) Requirement already satisfied: pypiwin32; "win32" in sys_platform in c:\users\MyName \appdata\local\programs\python\python38-32\lib\site-packages (from pyttsx3==2. 71) (223) Requirement already satisfied: pywin32>=223 in c:\users\MyName\appdata\local\progr ams\python\python38-32\lib\site-packages (from pypiwin32; "win32" in sys_platfor m->pyttsx3==2.71) (228) Installing collected packages: pyttsx3 Successfully installed pyttsx3-2.71
Then try running this example again:
import pyttsx3
engine = pyttsx3.init()
engine.say("Hello, I'm fixed.")
engine.runAndWait()