To close this thread: the PyEval_RestoreThread crash is a known bug in
the tkagg backend on Windows. See line 375 of backend_tkagg.py:

    def show(self):
        """
        this function doesn't segfault but causes the
        PyEval_RestoreThread: NULL state bug on win32
        """

-- Christoph

On 2/9/2010 10:26 AM, Christoph Gohlke wrote:
> Change the last line to pylab.show() and it should work.
> 
> Anyway, this example should not crash the interpreter. I can reproduce
> the crash on Python 2.4, 2.5, and 2.6 (32 and 64 bit) on Windows with
> mpl 0.99.1 but not on Ubuntu 9.1 with mpl 0.99.0.
> 
> The shortest example that crashes is:
> 
> python -c "import pylab;pylab.subplot(111).figure.show()"
> 
> or on the interactive prompt:
> 
>>>> import pylab
>>>> pylab.subplot(111).figure.show()
>>>> exit()
> Fatal Python error: PyEval_RestoreThread: NULL tstate
> 
> This application has requested the Runtime to terminate it in an unusual
> way.
> Please contact the application's support team for more information.
> 
> 
> -- Christoph
> 
> On 2/9/2010 7:57 AM, Lee Boger wrote:
>> > 
>> > Windows XP Professional with Python 2.5 installed (pywin32 build 210) -
>> > came with dSPACE software package
>> > 
>> > Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from
>> > sourceforge.net
>> > 
>> > Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe from
>> > sourceforge.net
>> > 
>> > Executing the following simple "log plot" script within PythonWin:
>> > 
>> > *from* matplotlib *import* pylab
>> > 
>> > # Create some artificial data.
>> > test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
>> > 17, 18, 19, 20]
>> > test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, -5,
>> > -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
>> > spec_frequency = [6, 8]
>> > spec_results = [-3.0, -3.0]
>> > 
>> > # Plot
>> > figure = pylab.subplot(111)
>> > figure.semilogx()
>> > figure.scatter(test_frequency, test_results, s=20, c='b', marker='s',
>> > edgecolors='none')
>> > figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s',
>> > edgecolors='none')
>> > figure.grid(True)
>> > figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
>> > figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)
>> > 
>> > figure.figure.savefig('log_plot')
>> > figure.figure.show()
>> > 
>> > 
>> > Plots a figure on the screen that looks correct, then the following
>> > error (when I click OK, PythonWin closes)
>> > 
>> > 
>> > 
>> > Any advice would be appreciated. Maybe it's an installation or setup
>> > issue, but I'm pretty knew to Python programming and don't know how to
>> > debug this.
>> > 
>> > Lee Boger

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to