Search code examples
pythoncx-freeze

cx_freeze: TypeError: __init__() got an unexpected keyword argument 'copyDependentFiles'


I am trying to create an executable for a Python script using Flask. For some reason when I am trying to generate the executable I am getting the following error:

C:\Users\jcalv\Downloads\Cache>python setup.py build Traceback (most recent call last): File "setup.py", line 12, in icon="incap.ico" TypeError: init() got an unexpected keyword argument 'copyDependentFiles'

This are the contents of my setup.py:

from cx_Freeze import setup, Executable

include_files = [ 'templates/']

packages = [ 'jinja2', 'jinja2.ext']
flaskapp = Executable(script="incap.py",
                      base="Win32GUI",
                      targetName="incap_cache.exe",
                      copyDependentFiles=True,
                      icon="incap.ico"                      
                  )
setup(
    name="Cache_Purger",
    version="1.0",
    author="J",
    description="Flask web app that allows...",
    options={
        'build_exe': {
            'include_files': include_files,
            'includes': packages,
            'build_exe': "build"
        }
    },
    executables=[flaskapp]
)

I am currently using Python 3.6.5 and cx-freeze-5.1.1.

Any help will be appreciated.


Solution

  • Since cx_freeze version 5.0 the setting copyDependentFiles has been removed from the Executable class.

    You can read about this (and delve into the pull requests that detail it in the release notes) as well as other changes in that and more recent versions.