Hi,
This simple script will animate correctly on Linux, but will not work on Windows (mpl 0.99.3) and at the end will crash with a message box (unknown software exception (0x40000015) at the location 0x1e05b62a) and prints to the console:
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.
Please check this. Thank you,
Jo�o Lu�s Silva
(script inline and attached)
anim.py (303 Bytes)
···
#-----------------------------------------------------------------------
import matplotlib.pyplot as plt
import numpy as np
plt.ion()
x = np.arange(0,2*np.pi,0.01) # x-array
data = np.array(np.sin(x))
line, = plt.plot(x,data)
for i in range(1,50):
data[:] = np.sin(x+i/10.0)
line.set_ydata(data)
plt.draw() # redraw the canvas
#-----------------------------------------------------------------------
The crash happens with the TKAgg backend but not with the GTKAgg backend, but the script will still not animate. This one will however:
···
#---------------------------------------
import matplotlib
matplotlib.use("GTKAgg")
import matplotlib.pyplot as plt
import numpy as np
plt.ion()
x = np.arange(0,2*np.pi,0.01) # x-array
data = np.array(np.sin(x))
line, = plt.plot(x,data)
for i in range(1,50):
data[:] = np.sin(x+i/10.0)
line.set_ydata(data+i-i)
plt.draw()
plt.ioff()
#---------------------------------------
Note the +i-i on the set_ydata. For some reason set_ydata won't update on Windows if the array is the same, even if the data has changed.
Jo�o Lu�s Silva
I can not reproduce this bug with matplotlib 1.0dev on Windows. So this is apparently fixed in svn trunk, probably by <matplotlib download | SourceForge.net; which is related to <http://sourceforge.net/tracker/?func=detail&aid=3015013&group_id=80706&atid=560720>
Christoph
···
On 6/24/2010 9:49 AM, João Luís Silva wrote:
Hi,
This simple script will animate correctly on Linux, but will not work on
Windows (mpl 0.99.3) and at the end will crash with a message box
(unknown software exception (0x40000015) at the location 0x1e05b62a) and
prints to the console:
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.