Search code examples
pythonpython-3.xpy2execx-freeze

Turning a py2exe setup.py file into one using cx_freeze


Until now I compiled only python2.7 files using py2exe. Today I tried compiling a python3.3 file using the 3.3 version of py2exe, but the setup() raised an exception I couldn't understand (AttributeError: 'DebugOutput' object has no attribute 'errors').

I thought that using a different compiling method (cx_freeze instead of py2exe) will maybe solve my problem, but I couldn't understand exactly what are the differences between them. what should I change in my code to make it work with cx_freeze? This is my setup():

setup(
    version=ver,
    description=name + ' by me',
    author='me',
    console=cons,
    windows=wind,
    data_files = [dats],
    options = {'build_exe': {'bundle_files': 1, 'compressed': True, 'optimize': 2, 'ascii': True, 'excludes': ex, 'includes': inc, 'dist_dir': distDir}},
    zipfile = None
)

Solution

  • Have a look at the docs for cx_freeze.

    Also when you install cx_freeze there is a file you can (using python) run from command line to generate a script for you. See this page.

    Hope this helps