Building Cocoa GUIs in Python with PyObjC, Part Five
Adding Python Modules to the Bundle
If you try to use Python modules on the standard OS X Python path import
statements will work fine. However, if you have non-standard modules that might be in a different location, or ones that you want to ship with, you will notice you can't just import
them.
To bring them into the application bundle you'll have to go through a couple steps, but when it is all done the application will be able to use the modules, and you don't have to require the end user to install anything extra.
Add the files to the Xcode project.
- Select 'Project -> Add to Project' (option-command-a)
- Select the Python module (directory) that you want to add.
-
On the next screen select "Copy items into destination group's folder (if needed)
- Select the correct targets in 'Add to Targets'
- Select "Create Folder References for ...