ronaldoussoren / py2app

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.
Other
354 stars 35 forks source link

Info.plist file must have a PyRuntimeLocations array #532

Open jwojcik999 opened 3 months ago

jwojcik999 commented 3 months ago

So, this is a new thing for us. Never had a problem with this app before. I love it, and thank you building it! However, just recently I tried to build my app again with only minor changes to my py code. After it builds the app, I get an error when running it and I have to terminate it. My app is basically a GUI using Tkinter. Here is the error message:

The Info.plist file must have a PyRuntimeLocations array containing string values for preferred Python runtime locations. These strings should be "otool -L" style mach ids; "@executable_stub" and "~" prefixes will be translated accordingly.

It this something new with a recent Mac OS update? I'm not a developer, so I would greatly appreciate any guidance you can give me or point me in the right direction. Thank you!

jwojcik999 commented 3 months ago

I should note that I tried adding this to the setup.py options: 'plist': {'PyRuntimeLocations': ['/Library/Frameworks/Python.framework/Versions/3.12/bin/python3',]} I found the directory using which python3 Also, I'm not running the -A option for an in-place app.

jwojcik999 commented 2 months ago

I narrowed this down to the pyodbc package. I'm using sqlalchemy to talk to an MSSQL server. For the connection engine, it's using pyodbc. Once I include the pyodbc package, the problem occurs with the PyRuntimeLocations array. I can't use an older pyodbc version with python 3.12, so I can't go lower than version 5.1. When I exclude the pyodbc package, then I get this error when I try to create a connection engine.

Unexpected error occured. dlopen(/dist/WCCApps.app/Contents/Resources/lib/python3.12/lib-dynload/pyodbc.so, 0x0002): Library not loaded: @loader_path/../../../../opt/libtool/lib/libltdl.7.dylib Referenced from: <91F8778A-6065-37AC-8768-9FF08039ACC4> /dist/WCCApps.app/Contents/Frameworks/libodbc.2.dylib Reason: tried: '/dist/WCCApps.app/Contents/Frameworks/../../../../opt/libtool/lib/libltdl.7.dylib' (no such file), '/usr/local/lib/libltdl.7.dylib' (no such file), '/usr/lib/libltdl.7.dylib' (no such file, not in dyld cache)

Any suggestions @ronaldoussoren or anyone? Thank you!

ronaldoussoren commented 2 months ago

Py2app currently does not support "@loader_path" for automatically including files. It might work to add the file explicitly by using "python3 setup.py py2app --frameworks=/path/to/libltdl.7.dylib".

jwojcik999 commented 2 months ago

Thank you @ronaldoussoren for the suggestion. I don't know where that dylib file lives to include it. I think it has something to do with libtools, which is already installed on my Mac.

Are you familiar with this original error message when starting my app (which included the pyodbc package)?

The Info.plist file must have a PyRuntimeLocations array containing string values for preferred Python runtime locations. These strings should be "otool -L" style mach ids; "@executable_stub" and "~" prefixes will be translated accordingly.