Py2App Can't find standard modules
Asked Answered
C

3

5

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?

Commonly answered 28/8, 2009 at 10:57 Comment(0)
G
5

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.

Gounod answered 11/1, 2010 at 16:50 Comment(0)
C
0

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

Commonly answered 28/8, 2009 at 11:12 Comment(0)
W
0

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()

Wino answered 28/8, 2009 at 22:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.