I am trying to use py2app to create a standalone application from some Python scripts. Python uses the "lxml" package, and I found that I have to specify this explicitly in the setup.py file that py2app uses. However, the resulting application program will still not work on machines that did not have lxml installed.
My Setup.py looks like this:
from setuptools import setup OPTIONS = {'argv_emulation': True, 'packages' : ['lxml']} setup(app=[MyApp.py], data_files=[], options={'py2app' : OPTIONS}, setup_requires=['py2app'])
Running the application causes the following output:
MyApp Error An unexpected error has occurred during execution of the main script ImportError: dlopen(/Users/ake/XXXX/XXXX/MyApp.app/Contents/Resources/lib/python2.5/lxml/etree.so, 2): Symbol not found: _xmlSchematronParse Referenced from: /Users/ake/XXXX/XXXX/MyApp.app/Contents/Resources/lib/python2.5/lxml/etree.so Expected in: dynamic lookup
The symbol "_xmlSchematronParse" is a library called "libxml2" on which "lxml" depends. The version that comes with Mac OS X preinstalled is not relevant enough for "lxml", so I had to install version 2.7.2 (in / usr / local). py2app is for some reason linked in a version in / Developer / SDKs / MacOSX 10.3.9.sdk / usr / lib. When I run my application as a Python script, although the correct version is found. (I checked it just now, hiding version 2.7.2.)
So now my question is: how can I tell py2app where to look for libraries?
python lxml py2app
Charles Anderson
source share