Hello,
I would like to be able to include the module 'appscript' in my Python-Cocoa app, built in XCode 3.
I know py2app will do this (however, I can't seem to get it to work), but it seems like it would be sensible if XCode should do this, and hence I wonder if anyone knows how to do it?
Any tips?
-Steve
Not tried it myself, but I think the following will work:
1. Download the appscript source distribution and build a non-egg copy of appscript using distutils (tweaking setup.py should do it).
2. Add the resulting 'aeosa' folder and 'aeosa.pth' file to your Xcode project, selecting the 'copy items into destination group's folder' and 'create folder references for any added folders' options.
When you build the project, these items will be added to Contents/Resources along with your project's own Python files, allowing the embedded copy of appscript to be imported by the rest of your project files. (Remember to temporarily disable your standard appscript installation in /Library/Python during testing, of course.)
I do strongly recommend using py2app, however. The standard Xcode Python templates are rather crap: along with the lack of automated dependency inclusion, if an end-user has a newer/older version of Python.framework installed, your application will import that version instead of the version it was built against, likely resulting in runtime failures.
If you're having problems with py2app and the supplied documentation and example projects haven't helped, best ask on the PythonMac-SIG mailing list as that's where the major Python wonks are usually found. Personally I've never had any trouble building my own applications with it (ASDictionary, etc.), although I don't use Xcode to write my Python-based apps, only IB.