[Pythonmac-SIG] py2app and dependencies

Paul McNett p at ulmcnett.com
Sat Oct 25 06:07:41 CEST 2008


Ryan Govostes wrote:
> I'm having some trouble with py2app messing up package dependencies. I 
> built py2app from SVN HEAD a few days ago because the version 
> distributed with Apple's Python 2.5 did not appear to support egg 
> dependencies.
> 
> 1. It is failing to find the text_format module of Google's protobuf 
> package, despite the fact that it is explicitly imported from 
> google.protobuf.message:
> 
>> from google.protobuf import text_format
> 
> 2. Another package is not explicitly imported, so I think I have to 
> specify it as a dependency. However, if I add it to the "packages" list, 
> I get an error
> 
>> ImportError: No module named xyzzy
>> > 
>> /Users/ryan/trunk/build/bdist.macosx-10.5-i386/egg/modulegraph/util.py(13)imp_find_module() 
>>
> 
> This is despite the fact that I can import the package with Python 
> interactively.
> 
> It also fails if I try making a recipe.
> 
> 
> Is there a way to tell py2app what to include explicitly in these cases? 
> Or should I do some post-build surgery on the resultant .app?

Experiment with making a main.py file whose dual purpose in life is to 
bootstrap your real_main.py file to start your app, and to explicitly 
import things to make py2app's job easier.

Or, I've had good luck with some packages to put them in "includes" 
instead.

Paul


More information about the Pythonmac-SIG mailing list