py2app TypeError: dyld_find() got an unexpected keyword argument 'loader'

前端 未结 2 1238
感动是毒
感动是毒 2020-12-18 03:43

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
2条回答
  •  囚心锁ツ
    2020-12-18 04:40

    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
    

提交回复
热议问题