0

I am working in a project where I want pyttsx3 to be installed.I am using Python 3.7. Version 2.90 is not getting installed so I installed v.2.71. Then i wrote this code [1]: https://i.stack.imgur.com/xNHhU.png But I Get This Error

  File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyttsx3\__init__.py", line 20, in init
    eng = _activeEngines[driverName]
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\weakref.py", line 137, in __getitem__
    o = self.data[key]()
KeyError: 'sapi5'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:/all python projects/Jarvis_Assistant_Project/Jarvis.py", line 4, in <module>
    engine = pyttsx3.init("sapi5")
  File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyttsx3\__init__.py", line 22, in init
    eng = Engine(driverName, debug)
  File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyttsx3\engine.py", line 30, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
  File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyttsx3\driver.py", line 50, in __init__
    self._module = importlib.import_module(name)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\pyttsx3\drivers\sapi5.py", line 3, in <module>
    import win32com.client
  File "C:\Users\admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\win32com\__init__.py", line 5, in <module>
    import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.```

PLS HELP ME AS SOON AS POSSIBLE AS THIS IS A VERY IMPORTANT PROJECT FOR ME.


  
Cool 91
  • 1
  • 1
  • Does this answer your question? [win32com import error python 3.4](https://stackoverflow.com/questions/22490233/win32com-import-error-python-3-4) – abhigyanj Dec 15 '20 at 06:37
  • It says KeyError. Could you share the code snippet as well. Surely the self.data does not contain any key by the name sapi5. Try looking into where exactly the data attribute is being modified. – Tanishq Vyas Dec 15 '20 at 06:40
  • What do you exactly want @Tanishq Vyas – Cool 91 Dec 15 '20 at 06:46
  • @Abhigyan Jaiswal No it is not helping. – Cool 91 Dec 15 '20 at 06:46
  • @Cool91 I want the code snippet – Tanishq Vyas Dec 15 '20 at 06:47
  • @Tanishq Vyas I have provided the image link in my post which is - https://i.stack.imgur.com/xNHhU.png – Cool 91 Dec 15 '20 at 07:10
  • what do u need sapi5 for ? – Tanishq Vyas Dec 15 '20 at 07:41
  • I suggest you make an issue by the same on the official repository. It looks like the init method expects an argument which is the driver name. Maybe there is no such driver present on your system which is represented by the name sapi5. – Tanishq Vyas Dec 15 '20 at 07:48
  • @Tanishq Vyas I want to build jarvis and for that i need voice input. How do u make an issue? pls help – Cool 91 Dec 15 '20 at 08:16
  • If your end goal is to get audio from the text then I would recommend you to take a look at this https://www.thepythoncode.com/article/convert-text-to-speech-in-python – Tanishq Vyas Dec 15 '20 at 11:31
  • @Tanishq Vyas For the project I am working on I require pyttsx3. This lobrary is recommended in the tutorial which I am following. So please try to help me with this library only . – Cool 91 Dec 15 '20 at 16:38

0 Answers0