pyttsx3
pyttsx3 copied to clipboard
ModuleNotFoundError: No module named 'pywintypes'
Got the Error above while running:
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
Full Output:
Traceback (most recent call last):
File "C:\Users\...\AppData\Roaming\Python\Python38\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Program Files\Python38\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 "<input>", line 2, in <module>
File "C:\Users\...\AppData\Roaming\Python\Python38\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\...\AppData\Roaming\Python\Python38\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\...\AppData\Roaming\Python\Python38\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "C:\Program Files\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\...\AppData\Roaming\Python\Python38\site-packages\pyttsx3\drivers\sapi5.py", line 10, in <module>
import pythoncom
File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.3.2\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\...\AppData\Roaming\Python\Python38\site-packages\pythoncom.py", line 2, in <module>
import pywintypes
File "C:\Program Files\JetBrains\PyCharm Community Edition 2020.3.2\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'pywintypes'
Any help?
Install the pypiwin32 module.
Having the pypiwin32 module, does not help fix this issue.
@Flynni123 @RedstonedLife
import win32api
please import win32api with pyttsx3. I faced the same problem for a long time but recently came to know that pypiwin32 is imported in program by name win32api (and not as pypiwin32 or pywintypes). Please do tell whether this solution works for you.
@Flynni123 @RedstonedLife
import win32apiplease import win32api with pyttsx3. I faced the same problem for a long time but recently came to know that pypiwin32 is imported in program by name win32api (and not as pypiwin32 or pywintypes). Please do tell whether this solution works for you.
not work 👎