8000 Check file path for animation and raise if it does not exist · matplotlib/matplotlib@64196ba · GitHub
[go: up one dir, main page]

Skip to content

Commit 64196ba

Browse files
committed
Check file path for animation and raise if it does not exist
1 parent 22d036e commit 64196ba

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/matplotlib/animation.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ def setup(self, fig, outfile, dpi=None):
193193
The DPI (or resolution) for the file. This controls the size
194194
in pixels of the resulting movie file.
195195
"""
196+
outdirectory = Path(outfile).parent
197+
if not outdirectory.exists():
198+
raise ValueError(f"{outdirectory} does not exist!")
196199
self.outfile = outfile
197200
self.fig = fig
198201
if dpi is None:
@@ -405,11 +408,7 @@ def setup(self, fig, outfile, dpi=None, frame_prefix=None):
405408
deleted by `finish`; if not *None*, no temporary files are
406409
deleted.
407410
"""
408-
self.fig = fig
409-
self.outfile = outfile
410-
if dpi is None:
411-
dpi = self.fig.dpi
412-
self.dpi = dpi
411+
super().setup(fig, outfile, dpi=dpi)
413412
self._adjust_frame_size()
414413

415414
if frame_prefix is None:

0 commit comments

Comments
 (0)
0