0

I am trying to convert my Python app to executable, I found that cx_Freeze would be easiest to modify and use it for my needs.

This is my setup.py script:

from cx_Freeze import setup, Executable

includefiles = ['Leaderboard.txt']
includes = ['PyQt4.QtGui', 'PyQt4.QtCore', 'functools.partial', 'multiprocessing.Process', 'sys']


setup(
    name = 'App',
    version = '1.0',
    description = 'Description',
    author = 'ShellRox',
    options = {'build_exe': {'include_files':includefiles}}, 
    executables = [Executable('Project.py', copyDependentFiles=True)]
)

Full code here.


For some reason, i am getting this error:

error: [Errno 2] No such file or directory: 'QtDesigner.framework/Versions/4/QtDesigner'

Full log here.

However i am not entirely sure what can the problem be, After doing some research i found only one result matching my problem and it wouldn't help at all ( I removed packages though ).

I also added only submodules in includes but it still wouldn't help, my guess is it was not looking for modules.

One thing that makes me wonder is if there is something associated with my reseources.py file.

I also tried adding QtDesigner location file to Path which didn't update anything else in progress.

Question:

What can the problem be? How can i blacklist it in cx_Freeze so it wont search for QtDesigner framework (If it is not useful), or do i need to add location in path so it can look for Qt Designer (If so, where would the path be?).

ShellRox
  • 2,532
  • 6
  • 42
  • 90

1 Answers1

0

cx_Freeze has an option to exclude binaries. Use that option to block searching for unwanted binaries. from the docs

bin_excludes - list of names of files to exclude when determining dependencies of binary files that would normally be included; note that version numbers that normally follow the shared object extension are stripped prior to performing the comparison

Add that option to your setup.py file inside build_exe options like this

build_exe_options = {
    "icon": iconPath,
    "packages": packages,
    "includes": includes,
    "include_files": include_files,
    "excludes": excludes,
    "optimize": True,
    "bin_excludes": ["QtDesigner"],
    }

But what if your code actually needed that executable file? If you look into the dependency using 'otool' you may find qtdesigner is required by PySide.QtUiTools module.

$ otool -L ~/lib/python2.7/site-packages/PySide/QtUiTools.so 
/lib/python2.7/site-packages/PySide/QtUiTools.so:
    @rpath/libpyside-python2.7.1.2.dylib (compatibility version 1.2.0, current version 1.2.2)
    /usr/local/lib/QtDesigner.framework/Versions/4/QtDesigner (compatibility version 4.8.0, current version 4.8.6)
    /usr/local/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.6)
    /usr/local/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.6)
    @rpath/libshiboken-python2.7.1.2.dylib (compatibility version 1.2.0, current version 1.2.2)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

So you better find where QtDesigner is located and use 'install_name_tool' to change the search path to the correct location for QtUiTools.so module.

Noortheen Raja
  • 791
  • 11
  • 15