[Pythonmac-SIG] py2app uses wrong version of wxPython?

Erik Westra ewestra at wave.co.nz
Wed Dec 14 20:36:54 CET 2005


Greetings,

I've been successfully using py2app for about a year now to build an  
application bundle out of a large wxPython application I've  
developed.  Recently, I upgraded my development machine to OSX  
10.4.2, and installed wxPython 2.6.1.0 and py2app 0.2.  I'm using the  
Apple-supplied Python interpreter (version 2.3.5) and the  
"TigerPython23Compat.pkg" package to ensure that the Python  
interpreter finds wxPython 2.6.1.0 instead of the Apple-suppled  
version 2.5.3.

This works fine when my application is run directly from the command- 
line -- a simple "import wx" correctly imports version 2.6.1.0 and  
the application runs as normal.  However, when I use py2app to create  
an application bundle, the resulting application starts up, but soon  
crashes because it's running a completely different version of  
wxPython -- not version 2.5.3, which would make some sense, but  
version 2.6.0.1!

The weird thing is that I never installed wxPython 2.6.0.1 on my  
machine -- the /Library/Python/2.3/wx-2.6-mac-ansi/wx/__version__.py  
file definitely shows the version as 2.6.1.0, and I used "grep" to  
search for the string "2.6.0.1" in "/Library" and "/System", without  
success.  So I'm at a complete loss to understand how an application  
bundle created using py2app could use a version of wxPython I never  
installed.

I'm not sure if the problem is an obscure bug in py2app, if something  
is screwed up in the wxPython 2.6.1.0 library (maybe it includes the  
wrong version of an .so files or something), or if I've done  
something stupid to cause the problem myself.  But, whatever the  
cause, it seems very strange that the following code:

     import wx
     print wx.__version__

prints "2.6.1.0" when run in the Python interpreter, but prints  
"2.6.0.1" when run as an application bundle built using py2app.

Any suggestions?

Note: I'm not using wxversion to choose the version of wxPython to  
use, so that shouldn't be causing any problems.

In case it helps, here's a (simplified) copy of the "setup.py" file  
I'm using to build the application using py2app:

#######################################################################

""" setup.py

     Simplified py2app setup script for the "Ensemble" application.
"""
from distutils.core import setup
import py2app
import sys
import os


def rmrf(path):
     """ Delete the given directory tree.
     """
     entries=os.listdir(path)
     for e in entries:
         fullname=os.path.join(path,e)
         if os.path.isdir(fullname):
             rmrf(fullname)
         else:
             os.remove(fullname)
     os.rmdir(path)


def buildApp():
     """ Build our standalone application, using py2app.

         We store our generated Ensemble.app bundle into the
         ensemble/build-mac/standalone directory.
     """
     if os.path.exists("disk-image"):
         rmrf("disk-image")

     os.mkdir("disk-image")
     os.mkdir("disk-image/dNet Ensemble")

     sys.path.insert(0, "../framework") # Won't be necessary with  
py2app v0.1.7

     plist = dict(
         CFBundleIconFile            = "Ensemble",
         CFBundleName                = "dNet Ensemble",
         CFBundleShortVersionString  = "2.x",
         CFBundleGetInfoString       = "dNet Ensemble 2.x",
         CFBundleExecutable          = "dNet Ensemble",
         CFBundleIdentifier          = "com.dnet.ensemble",
     )

     app = dict(script="../framework/main.py")

     setup(
         app=[app],
         options={'py2app' : {'bdist_base' : "temp",
                              'dist_dir'   : "disk-image/dNet Ensemble",
                              'iconfile'   : "Ensemble.icns",
                              'plist'      : plist,
                              'includes'   : "requiredModules",
                             },
                 }
     )


if __name__ == "__main__":
     buildApp()

#######################################################################

Thanks in advance for any suggestions you may have!

  - Erik.


More information about the Pythonmac-SIG mailing list