Search code examples
pythoncx-freeze

Is it possible to add exe file into cx_freeze python bdist_msi?


I need to add RemoveDrive.exe into cx-freeze msi package and tried

includefiles=['RemoveDrive.exe']

in setup.py but, it didn't get added to the package

Code:

from cx_Freeze import setup, Executable

build_exe_options = {"packages": ["os","shutil","datetime","subprocess"]}

includefiles = ['RemoveDrive.exe', 'whitelist.txt']
base = None

setup(  name = "whitelist",
        version = "0.1",
        description = "My application!",
        options = {"build_exe": build_exe_options},
        executables = [Executable("whitelisting.py", base=base)])

Solution

  • You should try this:

    from cx_Freeze import setup, Executable
    
    build_exe_options = {"packages": ["os","shutil","datetime","subprocess"]}
    
    includefiles = ['RemoveDrive.exe', 'whitelist.txt']
    base = None
    
    exe = Executable(script='whitelisting.py', base = base)
    
    setup(  name = "whitelist",
            version = "0.1",
            description = "My application!",
            options = {"build_exe": {'include_files':includefiles}},
            executables = [exe])