0

In Python3.9, I am using Typer CLI library to create an executable for windows. The project works fine with cmd, and I can create a executable with pyinstaller -c -F --hidden-import "pywin32" main.py. The executable is created correctly in the folder, but unfortunately when I run it the window closes immediately. This is the error message (I added the --hidden-import "pywin32" as in this post ):

Traceback (most recent call last):
  File "Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_win32comgenpy.py", line 40, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "win32com\__init__.py", line 5, in <module>
ImportError: DLL load failed while importing win32api: Unable to find the specified procedure.
[1464] Failed to execute script 'pyi_rth_win32comgenpy' due to unhandled exception!

I also try -hidden-import "pyi_rth_win32comgenpy" but the error is still present. This is the main.py

from peddy.src.eddypro_cli.cli import app

if __name__ == '__main__':
    while True:
        app()
Gianni Spear
  • 7,033
  • 22
  • 82
  • 131

0 Answers0