views:

82

answers:

3

I've created an app using py2app, which works fine, but if I zip/unzip it, the newly unzipped version can't access standard python modules like traceback, or os. The manpage for zip claims that it preserves resource forks, and I've seen other applications packaged this way (I need to be able to put this in a .zip file). How do I fix this?

A: 

use zip -y ... to create the file whilst preserving symlinks.

A: 

You probably need to give it your full PYTHONPATH.

Depends on your os. Here's how to find out:

import os [or any other std module] os.file()

Kenneth Reitz
+2  A: 

This is caused by building a semi-standalone version that contains symlinks to the natively installed files and as you say, the links are lost when zipping/unzipping unless the "-y" option is used.

An alternate solution is to build for standalone instead, which puts (public domain) files inside the application and so survives zipping/unzipping etc. better. It also means the app is more resilient to changes in the underlying OS. The downside is that it is bigger, of course, and is more complicated to get it set up.

To build a stand alone version, you need to install the python.org version which can be repackaged. An explanation of how to do this is here, but read the comments as there have been some changes since the blog post was written.

sthartle