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

Commit b001785

Browse filesBrowse files
committed
BUG: allow custom writers when no defaults are available
1 parent 6b17b17 commit b001785
Copy full SHA for b001785

File tree

Expand file treeCollapse file tree

1 file changed

+7
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-6
lines changed
Open diff view settings
Collapse file

‎lib/matplotlib/animation.py‎

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -595,11 +595,6 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
595595
the individual frames. This can be used to set tight bounding boxes,
596596
for example.
597597
'''
598-
if len(writers.list()) == 0:
599-
raise ValueError("Cannot save animation: no writers are "
600-
"available. Please install mencoder or "
601-
"ffmpeg to save animations.")
602-
603598
if savefig_kwargs is None:
604599
savefig_kwargs = {}
605600

@@ -662,7 +657,13 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
662657
else:
663658
import warnings
664659
warnings.warn("MovieWriter %s unavailable" % writer)
665-
writer = writers.list()[0]
660+
661+
try:
662+
writer = writers.list()[0]
663+
except:
664+
raise ValueError("Cannot save animation: no writers are "
665+
"available. Please install mencoder or "
666+
"ffmpeg to save animations.")
666667

667668
verbose.report('Animation.save using %s' % type(writer),
668669
level='helpful')

0 commit comments

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