1

I tries to convert my .py file to .exe which uses PYTTSX3 module through PyInstaller command and also imported hidden imports like pyttsx3.drivers, pyttsx3.drivers.sapi5.

Command used:

pyinstaller .\SCREENER.PY --hidden-import pyttsx3.drivers.sapi5 --hidden-import babel.numbers --hidden-import pythoncom

SCREENER is the name of my Python File*

But yet I'm getting this Error in my .exe file.

Please suggest me something to handle this, as this is my Final Year project, so I have to get this sorted anyhow.

Any help will be appreciated.

kiner_shah
  • 3,939
  • 7
  • 23
  • 37
  • Does this answer your question? [ImportError with cx\_freeze and pywin32: Module 'pythoncom' isn't in frozen sys.path](https://stackoverflow.com/questions/17891071/importerror-with-cx-freeze-and-pywin32-module-pythoncom-isnt-in-frozen-sys-p) – Thingamabobs Nov 14 '21 at 11:01

1 Answers1

0

The error may be as a result of spurious imports in your environment. Just had the exact same error.

Tried a few things on the link Thingamabobs added, and others as well.

Ended up making a clean environment, then running pyInstaller via:

pyInstaller --onefile -- paths "D:\Anaconda3\envs<MyEnv>\Lib\site-packages" myScript.py

[, D:\Anaconda3\ and myScript obviously being adjusted to your use]

And the problem was gone.

Amiga500
  • 1,258
  • 1
  • 6
  • 11