[Pythonmac-SIG] Trying to make an app

Bob Ippolito bob at redivi.com
Wed Oct 6 17:59:24 CEST 2004


On Oct 6, 2004, at 11:39 AM, Steven Palm wrote:

>
> On Oct 6, 2004, at 9:46 AM, Bob Ippolito wrote:
>> On Oct 6, 2004, at 10:36 AM, Steven Palm wrote:
>>> setting it up as well, but I can't immediately see a way to get 
>>> py2app to duplicate the tree.
>>>
>>>  They get copied like this:
>>>
>>>  copying ./resources/pblayout.xy -> BitPim.app/Contents/Resources
>>>
>>>  Any way to get py2app to preserve the original directory hierarchy?
>>
>> One way is to specify the resources folder instead of every file in 
>> the resources folder.  The default tree copier in py2app is going to 
>> ignore .svn and CVS garbage that may be in there so it's usually fine 
>> to do.
>
>  Unfortunately not everything in the directory gets put into the 
> bundle. :-(

Could you give me some hints as to what goes in and what does not?  I 
don't see any reason why this should be the case.

>> Another way is to specify a list of tuples.. which should definitely 
>> work but I haven't really tried it myself.
>>
>> setup(
>>     data_files=[('resources', ['./resources/pblayout.xy', ...]), ...],
>>     ...
>> )
>
>  That seemed to work.
>
>  I can't figure out the right syntax to get it to process an options 
> list to make an icon, set the dest_dir, etc... Maybe I'll just sit 
> back and wait for some of the more seasoned PythonMAC folks  to give 
> this a going-over.

You can do all of those on the commandline or you can set them in an 
options dictionary the same way you would with py2exe.

setup(
	...
	app=['myapp.py'],
	options=dict(py2app=dict(
		iconfile='myicon.icns',
		...
	)),
	...
)

>  Even though the `resource` files are where they are supposed to be, I 
> still get an error on running the program about recursion errors and 
> that it cannot find it's resource files.

This is probably a bug in your program.. without any more information I 
can't help you.  The current directory of a py2app bundle is the 
Resources folder, so open('resources/mydatafile') will just work unless 
you do a chdir.

-bob


More information about the Pythonmac-SIG mailing list