cx_Freeze - "The specified module could not be found"

Viewed 22

I've built an app using Tkinter, and when compiling it with cx_Freeze I get no issues.

When I run the .exe generated on my machine, and my virtual test machine, I have no issues. However, someone currently testing my app is encountering this issue:

error

Previously they had been encountering this issue:

other error

I fixed the issue of 'brotlicffi' not being found by bypassing py7zr by throwing it into a try statement, as it's not completely essential for the app to function. However, cefpython3 is.

What I find very confusing is that the paths in the traceback errors are all my paths, I've encountered this before with cx_Freeze, which threw me off at first but dismissed it as a possible quirk of cx_Freeze/Python.

Here is my cx_Freeze setup.py:

dir_path = os.getcwd()
interface_path = os.path.join(dir_path, "interface")

base = None

if sys.platform == 'win32':
    base = 'Win32GUI'

options = {"build_exe": {
    "packages": [
        "base64",
        "re",
        "os",
        "inspect",
        "_winapi",
        "json",
        "time",
        "selenium",
        "webdriver_manager",
        "tqdm",
        "pdfrw",
        "cefpython3",
        "customtkinter",
        "tkinter",
        "pyglet",
        "urllib",
        "py7zr",
        "brotli",
        "brotlicffi", # Needed for py7zr
        "winreg",
        "requests",
        "shutil",
        "stat",
        "inspect"
        ],
    # "path": [
    #     "C:\\Users\\aaron\\PycharmProjects\\slowly scraper\\venv\\Lib\\site-packages"
    # ],
    "include_files": [
        # "yellow.json",
        ("venv\\Lib\\site-packages\\brotli.py", "lib\\brotli.py"),
        "interface"
        # "cefpython3"
        ]
    # "replace_paths": [("*", "")]
    }
}
executables = [cx_Freeze.Executable(
    "main.py",
    base=base,
    target_name="SLD.exe",
    icon=os.path.join(interface_path, "SLD_icon.ico")
    )
]

cx_Freeze.setup(
    name="Slowly Letter Downloader",
    options=options,
    author="PastaSource",
    version="0.1",
    description="Automates the downloading of letters from Slowly",
    executables=executables
)

If it helps, I'm running this all in Pycharm, the includes the compilation of the cx_Freeze application.

0 Answers
Related