[Pythonmac-SIG] py2app question: Resources/Python -> Resources/lib/python2.4

Russell E. Owen rowen at cesmail.net
Mon Sep 11 20:29:14 CEST 2006


In article <6a36e7290609081607o1fdae1baj85745c1fc0c746 at mail.gmail.com>,
 "Bob Ippolito" <bob at redivi.com> wrote:

> On 9/8/06, Russell E. Owen <rowen at cesmail.net> wrote:
> > I was using an older version of py2app to distribute an application.
> > This placed the python library code in TUI.app/Contents/Resources/Python/
> >
> > I just upgraded to py2app 0.3.5 and now I find the same stuff is being
> > put in TUI.app/Contents/Resources/lib/python2.4/
> >
> > This change breaks my code because resource files need to go in the same
> > location, though I can certainly modify the code that copies the
> > resource files.
> 
> Put them in a package and include the package with the --packages option.
> 
> > My main question is: am I seeing this change because I'm doing something
> > wrong (in which case I'd like to fix it)? Or is it just the new way to
> > do things (in which case I can modify my resource copying code)?
> 
> New way.
> 
> > If it's the new way to do things, is there a recommended way to find
> > this directory automatically (or copy directory trees of files into it
> > automatically without knowing its name) -- to insulate myself against
> > future such changes?
> 
> If files are supposed to live with the code, it should be living in a
> python package.

Thank you very much.

I originally had my resources part of python packages because it made 
them much easier to find. But when I started creating Mac and Windows 
executables I separated out the resource files to avoid having them 
zipped up by bundlebuilder, py2exe and older versions of py2app.

Fortunately the resources files still live in top-level folders in the 
two packages that make up my code, so just listing those two packages 
does the trick. It's nice and easy.

It has the interesting (and harmless) side effect that the python code 
is no longer zipped up and the source code is now included.

-- Russell



More information about the Pythonmac-SIG mailing list