[GH-ISSUE #176] No module named pyttsx3.drivers #165

Closed
opened 2026-02-26 12:20:41 +03:00 by kerem · 3 comments
Owner

Originally created by @Sam-Varghese on GitHub (May 22, 2021).
Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/176

Hi, I have a very simple program, that is

import pyttsx3
engine = pyttsx3.init()
engine.say("HI sir, I am alright")
engine.runAndWait()

Now after converting this to exe, I noticed that the program was not running. On running the same exe file through command prompt, in order to get the reason why the program was not able to run, I got the following error message:

C:\Users\Hp\output>fun\fun.exe
Traceback (most recent call last):
  File "pyttsx3\__init__.py", line 20, in init
  File "weakref.py", line 134, in __getitem__
KeyError: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "fun.py", line 2, in <module>
  File "pyttsx3\__init__.py", line 22, in init
  File "pyttsx3\engine.py", line 30, in __init__
  File "pyttsx3\driver.py", line 50, in __init__
  File "importlib\__init__.py", line 127, in import_module
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pyttsx3.drivers'
[9520] Failed to execute script fun

I even typed pyttsx3 in the hidden import section, but the same error appeared.

I have pyttsx3 installed on my laptop, and the program was running well on vscode, but the following error occurred after converting it to an exe file. I am confused about what to do now, kindly help me to overcome this problem.

Originally created by @Sam-Varghese on GitHub (May 22, 2021). Original GitHub issue: https://github.com/brentvollebregt/auto-py-to-exe/issues/176 Hi, I have a very simple program, that is ```py import pyttsx3 engine = pyttsx3.init() engine.say("HI sir, I am alright") engine.runAndWait() ``` Now after converting this to exe, I noticed that the program was not running. On running the same exe file through command prompt, in order to get the reason why the program was not able to run, I got the following error message: ``` C:\Users\Hp\output>fun\fun.exe Traceback (most recent call last): File "pyttsx3\__init__.py", line 20, in init File "weakref.py", line 134, in __getitem__ KeyError: None During handling of the above exception, another exception occurred: Traceback (most recent call last): File "fun.py", line 2, in <module> File "pyttsx3\__init__.py", line 22, in init File "pyttsx3\engine.py", line 30, in __init__ File "pyttsx3\driver.py", line 50, in __init__ File "importlib\__init__.py", line 127, in import_module File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked ModuleNotFoundError: No module named 'pyttsx3.drivers' [9520] Failed to execute script fun ``` I even typed pyttsx3 in the hidden import section, but the same error appeared. I have pyttsx3 installed on my laptop, and the program was running well on vscode, but the following error occurred after converting it to an exe file. I am confused about what to do now, kindly help me to overcome this problem.
kerem closed this issue 2026-02-26 12:20:41 +03:00
Author
Owner

@Sam-Varghese commented on GitHub (May 22, 2021):

I needed to write pyttsx3.drivers in hidden imports which I did not write. The problem has now been solved, hence closing this issue. (Please refer to last lines of this solution)

<!-- gh-comment-id:846349316 --> @Sam-Varghese commented on GitHub (May 22, 2021): I needed to write `pyttsx3.drivers` in hidden imports which I did not write. The problem has now been solved, hence closing this issue. (Please refer to last lines of [this](https://stackoverflow.com/a/64764401/15446699) solution)
Author
Owner

@brentvollebregt commented on GitHub (May 22, 2021):

Thank you very much for sharing your solution!

<!-- gh-comment-id:846376436 --> @brentvollebregt commented on GitHub (May 22, 2021): Thank you very much for sharing your solution!
Author
Owner

@Sam-Varghese commented on GitHub (May 22, 2021):

You're welcome 🙂. Thanks to you also for doing such amazing works for the development of the community.

<!-- gh-comment-id:846381803 --> @Sam-Varghese commented on GitHub (May 22, 2021): You're welcome 🙂. Thanks to you also for doing such amazing works for the development of the community.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/auto-py-to-exe#165
No description provided.