matplotlib-0.54 Win98 crash

Hi John, I've now retraced my steps and discovered that

    > GTKAgg exhibits the crashing problem but TkAgg seems to
    > exhibit a different but maybe related problem.

    > I uninstalled 0.53.1 again and confirmed that the old
    > \site-packages\matplotlib directory was removed. I'm trying
    > the matplotlib-0.54.win32-py2.3.exe version with Numeric and
    > the only .matplotlibrc setting changed being backend :
    > GTKAgg

    >>>> import matplotlib
    > returns without complaint but
    >>>> import matplotlib.matlab
    > generates a pythonw illegal operation dialog with "PYTHONW
    > caused an invalid page fault" etc. and causes IDLE generates
    > a "================================ RESTART
    > ================================" line.

It looks like GUI conflict: GTK versus Idle Tk. This would explain
why TkAgg works but GTKAgg fails. Try running several of the examples
from the examples dir (not in an IDE but from the shell) with -dGTKAgg
and -dTkAgg and see if you have any troubles. If they work fine, at
least we'll have narrowed your trouble down to a GUI conflict. I
don't think you can expect GTK or GTKAgg to work from within IDLE.

Some of these issues are discussed on and

    > However, there are problems. For example, I tried running a
    > previously working plot script from SciTE and it now
    > generates an abnormal program termination MSVC++ Runtime
    > library error from pythonw.exe prior to a page fault. This
    > time, python generates something: Fatal Python error:
    > PyEval_RestoreThread: NULL tstate
    >> Process failed to respond; forcing abrupt termination...

I believe SciTE is a GTK based IDE, so you may not want to issue
"show" since this can get you into mainloop conflicts or threading
problems. I'm not 100% sure what happens when you call gtk.mainloop
twice from the same program, which is effectively what I think you be
doing if you called show from within scite.

Try doing this at the end of your script (this is a GTK / GTKAgg
specific option:


which will realize your figures w/o starting the mainloop, and
*should* work within a program where the pygtk mainloop is already
started. I don't know enough about scite to know if this will work or
not. The other thing that might happen is that nothing will show at
all (if scite is not pygtk). My guess is you will no longer get the
thread error, in which case at least we'll have learned something.