I\'m having difficulty building my app using py2app. I can build it in alias mode without issue using this command:
python3.4 setup.py py2app -A
You can monkey-patch macholib rather than modifying it in site-packages. Place the following file to the directory containing setup_py2app.py and add import macholib_patch
to the top.
macholib_patch.py:
"""
Monkey-patch macholib to fix "dyld_find() got an unexpected keyword argument 'loader'".
Add 'import macholib_patch' to the top of set_py2app.py
"""
import macholib
#print("~"*60 + "macholib verion: "+macholib.__version__)
if macholib.__version__ <= "1.7":
print("Applying macholib patch...")
import macholib.dyld
import macholib.MachOGraph
dyld_find_1_7 = macholib.dyld.dyld_find
def dyld_find(name, loader=None, **kwargs):
#print("~"*60 + "calling alternate dyld_find")
if loader is not None:
kwargs['loader_path'] = loader
return dyld_find_1_7(name, **kwargs)
macholib.MachOGraph.dyld_find = dyld_find
This is a temporary solution, and it may break other things. I would recommend doing this is a virtual environment so you don't mess up your regular packages. This worked for me (virtenv is the name of my virtual environment)
Open the file /virtenv/lib/python3.4/site-packages/macholib/dyld.py
and replace each instance of loader_path
with loader
. Now save and try again.