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

Appearance settings

[Bug]: 'PillowWriter' object has no attribute '_frame' shoudln't be '_frames'? #29519

Copy link
Copy link
Closed
@Anselmoo

Description

@Anselmoo
Issue body actions

Bug summary

It seems to be that gif animations cannot be generated anymore because of empty list for ax_fig.lines[0].get_xdata().

Currently, I got the following error in the CI run.

UNEXPECTED EXCEPTION: IndexError('list index out of range')
Traceback (most recent call last):
  File "/home/runner/work/useful-math-functions/useful-math-functions/.venv/lib/python3.10/site-packages/matplotlib/animation.py", line 224, in saving
    yield self
  File "/home/runner/work/useful-math-functions/useful-math-functions/.venv/lib/python3.10/site-packages/matplotlib/animation.py", line 1126, in save
    writer.grab_frame(**savefig_kwargs)
  File "/home/runner/work/useful-math-functions/useful-math-functions/.venv/lib/python3.10/site-packages/matplotlib/animation.py", line 499, in grab_frame
    self._frame.append(im)
AttributeError: 'PillowWriter' object has no attribute '_frame'. Did you mean: '_frames'?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/runner/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib/python3.10/doctest.py", line 1350, in __run
    exec(compile(example.source, filename, "single",
  File "<doctest umf.images.diagrams.ClassicPlot[30]>", line 1, in <module>
  File "/home/runner/work/useful-math-functions/useful-math-functions/umf/images/diagrams.py", line 335, in plot_save_gif
    anim.save(filename=fname, writer="imagemagick", dpi=settings.dpi, **kwargs)
  File "/home/runner/work/useful-math-functions/useful-math-functions/.venv/lib/python3.10/site-packages/matplotlib/animation.py", line 1098, in save
    with (writer.saving(self._fig, filename, dpi),
  File "/home/runner/.local/share/uv/python/cpython-3.10.16-linux-x86_64-gnu/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/runner/work/useful-math-functions/useful-math-functions/.venv/lib/python3.10/site-packages/matplotlib/animation.py", line 226, in saving
    self.finish()
  File "/home/runner/work/useful-math-functions/useful-math-functions/.venv/lib/python3.10/site-packages/matplotlib/animation.py", line 506, in finish
    self._frames[0].save(
IndexError: list index out of range
/home/runner/work/useful-math-functions/useful-math-functions/umf/images/diagrams.py:73: UnexpectedException

See also:

https://github.com/matplotlib/matplotlib/blob/f39bf4d2585746fce3ba39decba62693c82f194e/lib/matplotlib/animation.py#L499C21-L499C35

Code for reproduction

https://github.com/Anselmoo/useful-math-functions/pull/84

Actual outcome

AttributeError: 'PillowWriter' object has no attribute '_frame'. Did you mean: '_frames'?

Expected outcome

Working like previously Anselmoo/useful-math-functions#71

So, I have tested both backend poetry and uv, but it seems both are not working.

Additional information

If _frame is changed to _frames in local .venv, it is working fine.

dependencies = [
    "numpy>=2.0.0,<3",
    "pydantic>=2.0.0,<3",
    "scipy>=1.11.2,<2",
]

[project.optional-dependencies]
matplotlib = [
    "matplotlib (>=3.10.0,<4.0.0)",
    "imagemagic (>=0.2.1,<0.3.0)",
]

Operating system

No response

Matplotlib Version

3.10.0

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.