[Pythonmac-SIG] py2app question: path to included python

Ronald Oussoren ronaldoussoren at mac.com
Wed Jun 7 11:26:10 CEST 2006


 
On Wednesday, June 07, 2006, at 11:07AM, Russell E Owen <rowen at u.washington.edu> wrote:

>At 5:06 PM -0700 2006-06-05, Bob Ippolito wrote:
>>On Jun 5, 2006, at 4:56 PM, Russell E. Owen wrote:
>>
>>>When using py2app to create an application, is there a simple way to get
>>>the path to the copy of python that is/will be bundled into the
>>>application?
>>>
>>>(I need this to copy in some matploblit data files)
>>>So far I'm generating it manually using some assumptions. it works but
>>>if there's a safer/easier way, I'd rather use that.
>>
>>I don't know how matplotlib is structured, but you might want to 
>>look at writing a recipe for it. The pygame and PyOpenGL examples 
>>show how to include a few data files or an entire package as-is.
>
>That is a great idea. I'll take a look at creating such a recipe.
>
>Meanwhile...is there a simple way to get the path to the python 
>framework that is within the bundled application?

That's not really needed if matplotlib stores its datafiles in the same directory as its python files (that is in the package directory). In that case you can just explicitly include matplotlib (using the packages option). If that works you can create a recipe that does the same automaticly when a program depends on matplotlib.

>
>
>Also, one comment that may or may not be be relevant (since I've not 
>looked at the recipes yet): the right place for the matplotlib data 
>files is deep in the included python framework but...

That doesn't sound too good, do you mean the datafiles aren't in the package directory?

>
>I found (the hard way) that specifying data files that belong in the 
>tcl/tk framework (tcl extension libraries) fails miserably because 
>those files are copied *before* the tcl/tk framework, and in the 
>process a directory structure is created that blocks proper copying 
>of tcl/tk. (The root of the problem is my use of the link "Resources" 
>as a shortcut for the full path -- by copying files before that link 
>is created, it is created as a folder instead of a link).
>
>I can probably dodge the problem by not using links in the path. 
>Indeed, py2app doesn't seem to copy those handy shortcut links for 
>the python framework.

What shortcut links? Py2app special-cases the python framework because we know how it is structured and know what parts must be copied into the application to get a working bundle.

The tcl/tk framework is treated specially and that should mean the entire framework is copied verbatim. That again means that it shouldn't be necessary to specify that some additional datafiles in that framework should be copied because they'll be included anyway.

Ronald


More information about the Pythonmac-SIG mailing list