Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a367714

Browse files
committed
FIX: leaking temporary files in animation saving
1 parent bb99770 commit a367714

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/matplotlib/animation.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -468,15 +468,13 @@ def grab_frame(self, **savefig_kwargs):
468468
def finish(self):
469469
# Call run here now that all frame grabbing is done. All temp files
470470
# are available to be assembled.
471-
self._run()
472-
super().finish() # Will call clean-up
473-
474-
def _cleanup(self): # Inline to finish() once cleanup() is removed.
475-
super()._cleanup()
476-
if self._tmpdir:
477-
_log.debug('MovieWriter: clearing temporary path=%s', self._tmpdir)
478-
self._tmpdir.cleanup()
479-
471+
try:
472+
self._run()
473+
super().finish()
474+
finally:
475+
if self._tmpdir:
476+
_log.debug('MovieWriter: clearing temporary path=%s', self._tmpdir)
477+
self._tmpdir.cleanup()
480478

481479
@writers.register('pillow')
482480
class PillowWriter(AbstractMovieWriter):

0 commit comments

Comments
 (0)