tags:

views:

13

answers:

1

I've written a PyObjC application that depends on the Python paramiko (ssh) library. Is there a way that I can add the third-party library to my application so that users do not need to sudo easy_install paramiko before running the application?

I can see that it is possible to add the python framework to my project, but I don't think that'd include what is in my /Library/Python/2.5/site-packages/paramiko path. Alternatively, as the project is pure python, I imagine I can just incorporate it into my code, but that really doesn't seem like a proper way to include a library (and I'd be interested in knowing what to do if the library I needed were not pure python).

Is there a good way to include a third-party python library in a PyObjC application?

While I am using XCode 3.1.4 on OS X 10.5.8, instructions for other versions of XCode should be fine.

A: 

This appears to work.

In Xcode, right click on "Resources" and choose "Add -> Existing Files ...". Browse to the path for your library, in this case, /Library/Python/2.5/site-packages/paramiko, and hit the "Add" button. A sheet will come up asking for how you want to add it to the project. Make sure "Copy items into destination group's folder (if needed)" is checked, and, instead of the default "Recursively create groups for any added folders" use "Create Folder References for any added folders". [I left the other two settings at their defaults. Reference Type: Default and Add To Targets: YourApplicationName (checked)]

When you build the program, it will now copy the folder into the Resources folder of your project, where the files will be found when import paramiko is run. I also has to import the Crypto library in the same way (and I believe it is not a pure python library).

When I tested it on another OS X 10.5 box which did not have the requisite libraries, it ran fine.

Clinton Blackmore