You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use tempfile.mkdtemp for animation.FileMovieWriter.
Currently, `animation.FileMovieWriter` (e.g. `FFMpegFileWriter`)
creates temporaries in the current folder, without even checking
whether the file existed before. This is obviously risky (e.g., create
a file named `_tmp0000000.png` in the current folder before running
`moviewriter.py` from the docs examples and it will be overwritten.
Moveover, temporaries are not cleaned up if an exception is raised
(e.g., KeyboardInterrupt).
This is relatively easy to fix using `tempfile.mkdtemp`, although I
had to modify `finish` so that it doesn't call `cleanup` by itself
(obviously, this can be fixed by keeping a `cleaned_up` attribute
but it feels like a minor API change is preferable; moreover the
context-manager API stays the same).
Only basic, manual testing done.
0 commit comments