Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit400ea30

Browse files
committed
FIX: Explicitly clean up temporary files in HTMLWriter
- HTMLWriter inherits from FileMovieWriter.- FileMovieWriter create a non-context manager TemporayDirectory on init.- The TemporayDirectory is cleaned up in the cleaup method of FileMovieWriter.- However this method (and its call chain through finish) try to either call a subprocess to merge a bunch of single-frame files into a movie (not relevant) or to clean up such a process (not relevant).- The least disruptive fix is to duplicate the file clean up code.
1 parentcb7c722 commit400ea30

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎lib/matplotlib/animation.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,22 @@ def finish(self):
891891
interval=interval,
892892
**mode_dict))
893893

894+
# duplicate the temporary file clean up logic from
895+
# FileMovieWriter.cleanup. We can not call the inherited
896+
# versions of finished or cleanup because both assume that
897+
# there is a subprocess that we either need to call to merge
898+
# many frames together or that there is a subprocess call that
899+
# we need to clean up.
900+
ifself._tmpdir:
901+
_log.debug('MovieWriter: clearing temporary path=%s',self._tmpdir)
902+
self._tmpdir.cleanup()
903+
else:
904+
ifself._clear_temp:
905+
_log.debug('MovieWriter: clearing temporary paths=%s',
906+
self._temp_paths)
907+
forpathinself._temp_paths:
908+
path.unlink()
909+
894910

895911
classAnimation:
896912
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp