File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1087,17 +1087,13 @@ def func(current_frame: int, total_frames: int) -> Any
10871087 # If we have the name of a writer, instantiate an instance of the
10881088 # registered class.
10891089 if isinstance (writer , str ):
1090- if writers .is_available (writer ):
1091- writer = writers [writer ](fps , ** writer_kwargs )
1092- else :
1093- alt_writer = next (iter (writers ), None )
1094- if alt_writer is None :
1095- raise ValueError ("Cannot save animation: no writers are "
1096- "available. Please install ffmpeg to "
1097- "save animations." )
1098- _log .warning ("MovieWriter %s unavailable; trying to use %s "
1099- "instead." , writer , alt_writer )
1100- writer = alt_writer (fps , ** writer_kwargs )
1090+ try :
1091+ writer_cls = writers [writer ]
1092+ except RuntimeError : # Raised if not available.
1093+ writer_cls = PillowWriter # Always available.
1094+ _log .warning ("MovieWriter %s unavailable; using Pillow "
1095+ "instead." , writer )
1096+ writer = writer_cls (fps , ** writer_kwargs )
11011097 _log .info ('Animation.save using %s' , type (writer ))
11021098
11031099 if 'bbox_inches' in savefig_kwargs :
You can’t perform that action at this time.
0 commit comments