mhammond / pywin32

Python for Windows (pywin32) Extensions
5.08k stars 800 forks source link

While using pyttsx 3 , I am having the following ERROR, i have installed pypiwin32 #1557

Closed pragyan-srivastava closed 4 years ago

pragyan-srivastava commented 4 years ago

My Program :

import pyttsx3

engine = pyttsx3.init()

engine.say('Welcome')

engine.runAndWait()

ERROR :

Traceback (most recent call last): File "C:\Users\prag1\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 "e:/PYTHON PROJECTS/voice.py", line 2, in engine = pyttsx3.init() File "C:\Users\prag1\AppData\Roaming\Python\Python38\site-packages\pyttsx3__init.py", line 22, in init eng = Engine(driverName, debug) File "C:\Users\prag1\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\prag1\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 "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 783, in exec_module File "", line 219, in _call_with_frames_removed File "C:\Users\prag1\AppData\Roaming\Python\Python38\site-packages\pyttsx3\drivers\sapi5.py", line 10, in import pythoncom File "C:\Users\prag1\AppData\Roaming\Python\Python38\site-packages\pythoncom.py", line 2, in import pywintypes File "C:\Users\prag1\AppData\Roaming\Python\Python38\site-packages\win32\lib\pywintypes.py", line 136, in import_pywin32_system_module("pywintypes", globals()) File "C:\Users\prag1\AppData\Roaming\Python\Python38\site-packages\win32\lib\pywintypes.py", line 110, in import_pywin32_system_module__ raise ImportError("No system module '%s' (%s)" % (modname, filename)) ImportError: No system module 'pywintypes' (pywintypes38.dll)

PLEASE HELP !!

kxrob commented 4 years ago

Did you install pywin32 via Pypi? I remember that I was never happy with that - incomplete in several aspects - and used the exe/msi installers the releases here. Which pywin32 build? Is your pywintypes38.dll not in one of those places ? :

<WINSYSTEM32>
<PY>
<PY>\Lib\site-packages\win32\lib
<PY>\Lib\site-packages\pywin32_system32

Or somewhere else?

>>> import pywintypes
>>> pywintypes
<module 'pywintypes' (C:\WINDOWS\SYSTEM32\pywintypes37.dll)>

May be a bug of the Pypi wheel variant or an issue of the single user install. May not be up to date. Maybe move/copy it (pythoncom38.dll etc.) to one of thoses places. Maybe do pip uninstall pywin32 and install it from the released exe/msi installers here.

mhammond commented 4 years ago

Also, pypiwin32 is very old and was never official - there's no plain old 'pywin32' on pypi.