pythonpython-3.xctypescx-freezepython-3.8

cx_Freeze ImportError: DLL load failed failed while importing _ctypes: The specified module could not be found


I compiled some Python scripts with cx_Freeze but compiled scripts giving me this error:

click to see error

setup.py:

from cx_Freeze import setup, Executable

executables = [
    Executable('USBAIO.py', base="Win32GUI", icon="Icons\\icon.ico"),
    Executable('ui.py', base="Win32GUI", icon="Icons\\icon.ico"),
    Executable("formatter.py", base="Win32GUI", icon="Icons\\cicon.ico"),
    Executable("updater.py", base="Win32GUI", icon="Icons\\uicon.ico"),
    Executable("permremove.py", base="Win32GUI", icon="Icons\\cicon.ico")
    ]

Packages = ["tkinter","functools", "time", "win32api",
                    "threading", "subprocess", "psutil", "os",
                    "shutil", "re", "requests", "sys", "ctypes",
                    "argparse", "google_drive_downloader",
                    "win32file", "win32con"
                    ]

Include = ["Icons", "version.txt", "icon.ico"]

setup(
    name="myapp",
    options={"build_exe":{"packages":Packages,"include_files":Include}},
    description = "myapp",
    executables = executables
)

Python version: 3.8

Windows: 8.1 Pro WMC

cx_Freeze: 6.0b1


Solution

  • Well, I found the answer. The error caused by a DLL that cx_Freeze couldn't grab. When I copy the libffi-7.dll to lib folder my application works fine. Here is my research: research