pylab crashes python

hi,

I use python 2.4, matplotlib and WXpython on OS X.

I plot and show something and every thing works fine (the plot is shown in the python.app).
I close the plot window.
I plot another thing.
It is shown again with python.app, but now python.app crashes...

every second plot causes a crash in python.app...

has anybody a hint?

thanks Jan

Jan,

What versions of wxPython and matplotlib are you using?

Ken

Are you running the script again or plotting a second
time in the same script? You might need to set
matplotlib to plot interactively. See the
documentaion about interactive plotting. You need to
set the back end graphics to the right kind for
interactive plotting.

E.g. in .matplotlibrc

backend : TKAgg # should work for
interactive
interactive : True # see
http://matplotlib.sourceforge.net/interactive.html

-- Lou Pecora
      My views are my own.

···

____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

Jan Winter wrote:

hi,

I use python 2.4, matplotlib and WXpython on OS X.

I plot and show something and every thing works fine (the plot is shown in the python.app).
I close the plot window.
I plot another thing.
It is shown again with python.app, but now python.app crashes...

I'm not sure pylab supports this use. I think once you close the plot window, you have shut down the wx.App, then when you plot again, it tries to create it again, but you can't start and stop wx.Apps over again in the same process.

I think you can do what you want by using ipython, so that you don't have to close the figure window to get your prompt back.

-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@...259...

I found an example script I got to work for WX. I
guessed that the ws.app had to be deleted to plot
again. Here it is (the part that runs the code and
creates the WX.app:

if __name__ == '__main__':
    app = wx.PySimpleApp(0)
    frame = PlotFigure()
    frame.plot_data()
    frame.Show()
    app.MainLoop()
    #must delete app before reusing for wxPython
    del app # <<---- THE CRUCIAL STEP
    print "done with plot 1"
    
    app = wx.PySimpleApp(0)
    frame = PlotFigure()
    frame.plot_data()
    frame.Show()
    app.MainLoop()
    print "done with plot 2"

Without the delete you get a crash/hang.

-- Lou Pecora
      My views are my own.

···

____________________________________________________________________________________
We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265