2

As I am new in Python, I made a VOICE ASSISTANT by Python in Pycharm. I only write the code and run I in the pycharm, it ran smoothly. I haven't made any GUI for it. I just converted the code in the EXE file by using the Pyinstaller. when I run the exe file, it has shown me this error in Command Prompt.

Traceback (most recent call last):
  File "site-packages\pyttsx3\__init__.py", line 20, in init
  File "c:\users\faizan\appdata\local\programs\python\python36\lib\weakref.py", line 131, in 
__getitem__
    o = self.data[key]()
KeyError: 'sapi5'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "s.py", line 15, in <module>
  File "site-packages\pyttsx3\__init__.py", line 22, in init
  File "site-packages\pyttsx3\engine.py", line 30, in __init__
  File "site-packages\pyttsx3\driver.py", line 50, in __init__
  File "importlib\__init__.py", line 126, in import_module
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pyttsx3.drivers'
[2844] Failed to execute script s

I think, this the problem of many beginners. Please Help.

1

1 Answer 1

1

Use hidden import to specify the module while creating exe,

$ pyinstaller --hidden-import=pyttsx3.drivers yourscript.py
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.