Error with backend_wx.py after packaging with py2app

Hello, list!

I am trying to create a Mac application package from python modules
using matplotlib and wxpython.
Before packaging, my code generated only a user warning of multiple
calls on matplotlib.use method.
When I tried to run the application after packaging with py2app, the
application crashed with the following error message:

....
app/Contents/Resources/lib/python2.6/matplotlib/backends/backend_wx.py
line 1769 in _init_toolbar ..
app/Contents/Resources/lib/python2.6/matplotlib/backends/backend_wx.py
line 1609 in _load_bitmap ..
app/Contents/Resources/lib/python2.6/wx/_gdi.py line 555 in
__init__ ..
PyAssertionError: C++ assertion "IsOpened()" failed at /BUILD/wxPython-
src-2.8.11.0/src/common/ffile.cpp(175)
in Seek(): can't seek on closed file

My environment is as follows:
Mac OS X Leopard
MacPython 2.6
wxPython 2.8.11 (installed from binary package)
matplotlib 1.0.0 (installed from binary package)

Please let me know how I can solve this problem.

Thanks in advance!

First, make sure that matplolib's data files (including the images it uses for its toolbars) are included in your application bundle. Next, you'll want to be sure that matplotlib knows how to look for them inside the bundle.

···

On 9/3/10 11:13 AM, Hang-A wrote:

Hello, list!

I am trying to create a Mac application package from python modules
using matplotlib and wxpython.
Before packaging, my code generated only a user warning of multiple
calls on matplotlib.use method.
When I tried to run the application after packaging with py2app, the
application crashed with the following error message:

....
app/Contents/Resources/lib/python2.6/matplotlib/backends/backend_wx.py
line 1769 in _init_toolbar ..
app/Contents/Resources/lib/python2.6/matplotlib/backends/backend_wx.py
line 1609 in _load_bitmap ..
app/Contents/Resources/lib/python2.6/wx/_gdi.py line 555 in
__init__ ..
PyAssertionError: C++ assertion "IsOpened()" failed at /BUILD/wxPython-
src-2.8.11.0/src/common/ffile.cpp(175)
in Seek(): can't seek on closed file

My environment is as follows:
Mac OS X Leopard
MacPython 2.6
wxPython 2.8.11 (installed from binary package)
matplotlib 1.0.0 (installed from binary package)

Please let me know how I can solve this problem.

--
Robin Dunn
Software Craftsman