Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Bug summary
In some case it seem that FuncAnimation in Jupyter + matplotlib widgets + funcanimation just swallow error, leading to hard to debug error as to why animations don't show.
Code for reproduction
Here is a dumb animation where the animate part, raise an error (in the original code this was a typo so a NameError, but for readability, here an assert).
%matplotlibwidgetimportmatplotlib.pyplotaspltfrommatplotlib.animationimportFuncAnimationNx=101x=list(range(10))defu_func(t):return [x+t//10forxinrange(10)]fig,ax=plt.subplots()dt_ms=50u0=u_func(0)line=ax.plot(x,u0)[0]defanimate(n):""" Fonction principale qui met à jour l'image d'un pas de temps à un autre Entrée : n : pas de temps courant """line.set_ydata(u_func(n))assertFalse,"anything that triggers and error like a typo"returnlineanim=FuncAnimation(fig,animate,interval=dt_ms,frames=50,repeat=True)
Actual outcome
Animation not happening
Expected outcome
Show at least a warnings that the animate function raised
Additional information
I tried to print a trace as to when the animate function get called see
https://gist.github.com/Carreau/e6510855ecab88630f1ea5985a98358c
This is likely multiple problems, matpltolib may want have an explicit warning that animate crash, but ipympl, comm, and ipykernel itself should likely have error messages as well.
Operating system
osx
Matplotlib Version
3.8.3
Matplotlib Backend
module://ipympl.backend_nbagg
Python version
3.11
Jupyter version
4.0.9
Installation
pip