# Buggy code
def _FreezeExecutable(self, exe):
    finder = self.finder
    finder.IncludeFile(exe.script, exe.moduleName)
    finder.IncludeFile(exe.initScript, exe.initModuleName)

    self._CopyFile(exe.base, exe.targetName, copyDependentFiles=True, includeMode=True)
    if self.includeMSVCR:
        self._IncludeMSVCR(exe)

    # Copy icon
    if exe.icon is not None:
        if sys.platform == "win32":
            import cx_Freeze.util

            cx_Freeze.util.AddIcon(exe.targetName, exe.icon)
        else:
            targetName = os.path.join(
                os.path.dirname(exe.targetName), os.path.basename(exe.icon)
            )
            self._CopyFile(exe.icon, targetName, copyDependentFiles=False)

    if not os.access(exe.targetName, os.W_OK):
        mode = os.stat(exe.targetName).st_mode
        os.chmod(exe.targetName, mode | stat.S_IWUSR)
    if self.metadata is not None and sys.platform == "win32":
        self._AddVersionResource(exe.targetName)


# Traceback (cx_Freeze.freezer.ConfigError)
C:\Users\Belli\Desktop\failing_cx_freeze>python setup.py build
running build
running build_exe
creating directory demo
copying C:\Miniconda\lib\site-packages\cx_Freeze\bases\Win32GUI.exe -> demo\demo.exe
Stamped: demo\demo.exe
writing zip file demo\demo.zip

Name                      File
----                      ----
m __main__                  demo.py
m cx_Freeze__init__         C:\Miniconda\lib\site-packages\cx_Freeze\initscripts\Console.py

Traceback (most recent call last):
File "setup.py", line 47, in <module>
executables = [GUI2Exe_Target_1]
File "C:\Miniconda\lib\site-packages\cx_Freeze\dist.py", line 362, in setup
distutils.core.setup(**attrs)
File "C:\Miniconda\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Miniconda\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Miniconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Miniconda\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Miniconda\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Miniconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Miniconda\lib\site-packages\cx_Freeze\dist.py", line 232, in run
freezer.Freeze()
File "C:\Miniconda\lib\site-packages\cx_Freeze\freezer.py", line 610, in Freeze
self.compress, self.copyDependentFiles)
File "C:\Miniconda\lib\site-packages\cx_Freeze\freezer.py", line 510, in _WriteModules
module.Create(finder)
File "C:\Miniconda\lib\site-packages\cx_Freeze\freezer.py", line 746, in Create
module.file, module.name)
cx_Freeze.freezer.ConfigError: no file named sys (for module CoolProp.CoolProp.sys)

# Fixed code
def _FreezeExecutable(self, exe):
    finder = self.finder
    finder.IncludeFile(exe.script, exe.moduleName)
    finder.IncludeFile(exe.initScript, exe.initModuleName)

    self._CopyFile(exe.base, exe.targetName, copyDependentFiles=True, includeMode=True)
    if self.includeMSVCR:
        self._IncludeMSVCR(exe)

    # Copy icon
    if exe.icon is not None:
        if sys.platform == "win32":
            import cx_Freeze.util

            cx_Freeze.util.AddIcon(exe.targetName, exe.icon)
        else:
            targetName = os.path.join(
                os.path.dirname(exe.targetName), os.path.basename(exe.icon)
            )
            self._CopyFile(exe.icon, targetName, copyDependentFiles=False)

    if not os.access(exe.targetName, os.W_OK):
        mode = os.stat(exe.targetName).st_mode
        os.chmod(exe.targetName, mode | stat.S_IWUSR)
    if self.metadata is not None and sys.platform == "win32":
        self._AddVersionResource(exe)