diff --git a/CHANGELOG.md b/CHANGELOG.md index f35b9a96..c8125cfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,9 @@ In an effort to better document changes, this CHANGELOG document is now created. [#253](https://github.com/jeertmans/manim-slides/discussions/253), caused by Python 3.11's change in how `Enum` work. [#257](https://github.com/jeertmans/manim-slides/pull/257). +- Fixed potential non-existing parent path issue in + `manim convert`'s destination path. + [#262](https://github.com/jeertmans/manim-slides/pull/262) ### Removed diff --git a/manim_slides/convert.py b/manim_slides/convert.py index cdce0533..cdb968b1 100644 --- a/manim_slides/convert.py +++ b/manim_slides/convert.py @@ -378,6 +378,8 @@ def convert_to(self, dest: Path) -> None: for presentation_config in self.presentation_configs: presentation_config.copy_to(full_assets_dir) + dest.parent.mkdir(parents=True, exist_ok=True) + with open(dest, "w") as f: revealjs_template = Template(self.load_template()) @@ -434,6 +436,8 @@ def read_image_from_video_file(file: Path, frame_index: FrameIndex) -> Image: read_image_from_video_file(slide_config.file, self.frame_index) ) + dest.parent.mkdir(parents=True, exist_ok=True) + images[0].save( dest, "PDF", @@ -524,6 +528,7 @@ def save_first_image_from_video_file(file: Path) -> Optional[str]: if self.auto_play_media: auto_play_media(movie, loop=slide_config.is_loop()) + dest.parent.mkdir(parents=True, exist_ok=True) prs.save(dest)