Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: Swallowed error in Jupyter+Matplotlib FuncAnimation. #27822

Open
@Carreau

Description

@Carreau

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp