8000 [Bug]: 'PillowWriter' object has no attribute '_frame' shoudln't be '_frames'? · Issue #29519 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Anselmoo opened this issue Jan 25, 2025 · 0 comments · Fixed by #29520
Closed

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

Anselmoo opened this issue Jan 25, 2025 · 0 comments · Fixed by #29520
Milestone

Comments

@Anselmoo
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0