Problems getting started with py2app and wxPython

View: New views
2 Messages — Rating Filter:   Alert me  

Problems getting started with py2app and wxPython

by Jeff Garbers-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello! I'm just getting started trying to build a standalone Mac  
application based on wxPython.  I'm on OS X 10.6.1, using Python 2.6.1  
as distributed with the OS.

The app is a simple "hello world" type of thing:

> import wx
>
> class MyApp(wx.App):
>     def OnInit(self):
>         frame = wx.Frame(None, -1, "Hello from wxPython")
>         frame.Show(True)
>         self.SetTopWindow(frame)
>         return True
>
> app = MyApp(0)
> app.MainLoop()
>


I generate my setup.py with py2applet and build the app:

> py2applet --make-setup wxtest.py
> python setup.py py2app

All appears to go well, but when I run the resulting app, I get an  
error immediately:

> wxtest Error
> An unexpected error has occurred during execution of the main script
>
> ImportError: '/usr/lib/python2.6/lib-dynload/wx/_core_.so' not found

Reviewing the output from py2app, I notice that that module -- among  
others -- was stripped:

> ...
> stripping libwx_macud-2.8.0.dylib
> stripping _controls_.so
> stripping wxtest
> stripping _core_.so
> stripping _misc_.so
> stripping _gdi_.so
> stripping _windows_.so


I've been spoiled by things "just working" in both OS X and Python, so  
this sort of thing throws me for a
loop, especially as a rookie.   Why is pyapp stripping those modules,  
and how can I keep it from doing so?
Can anybody suggest a fix or point me in the right direction? Thanks  
in advance for any help you can offer.








 
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig

Re: Problems getting started with py2app and wxPython

by Christopher Barker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jeff Garbers wrote:
> Hello! I'm just getting started trying to build a standalone Mac
> application based on wxPython.  I'm on OS X 10.6.1, using Python 2.6.1
> as distributed with the OS.

note that py2ap will not bundle up python itself in this case, and your
app will only work on 10.6 systems.

>> ImportError: '/usr/lib/python2.6/lib-dynload/wx/_core_.so' not found

hmmm -- this means it's looking in your system, rather than the bundle,
for the wx libs...

> Reviewing the output from py2app, I notice that that module -- among
> others -- was stripped:
>
>> ...
>> stripping libwx_macud-2.8.0.dylib
>> stripping _controls_.so
>> stripping wxtest
>> stripping _core_.so
>> stripping _misc_.so
>> stripping _gdi_.so
>> stripping _windows_.so

>  Why is pyapp stripping those modules,

stripping does not mean removing -- I thin it means removing debug
symbols, etc, i.e. making it smaller. It should not cause this problem.

Aside from putting dylibs into the bundle, py2app also re-writes the
headers, so that they are linked against the copies in the bundle,
rather than the system ones -- it looks like this has gone awry.

Do take a look in the bundle ans see what's there. It's very helpful for
debugging.


I'm not running 10.6, or python2.6, so I'm not much help here, but do
make sure that you are running the latest py2app -- there have been 2.6
fixes recently.

You also might try installing a Python.org build, and using that instead
of Apple's -- you'll need to do that if you want to support older
systems anyway.

-Chris




--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@...
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@...
http://mail.python.org/mailman/listinfo/pythonmac-sig