diff --git a/CHANGELOG.md b/CHANGELOG.md index 4926250..c5c91f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog: rich-codex +## Version 1.2.6 (2022-10-03) + +- 🐛 Handle `OSError` when creating directories with a log message instead of crashing + ## Version 1.2.5 (2022-08-25) - 🐛 Tweak output whitespace, fix use of `Path.absolute()` ([#39](https://github.com/ewels/rich-codex/pull/39)) diff --git a/src/rich_codex/__init__.py b/src/rich_codex/__init__.py index c390601..f3a75de 100644 --- a/src/rich_codex/__init__.py +++ b/src/rich_codex/__init__.py @@ -5,6 +5,6 @@ for use with the rich-codex GitHub Action. """ -__version__ = "1.2.5" +__version__ = "1.2.6" from rich_codex import rich_img # noqa: F401 diff --git a/src/rich_codex/rich_img.py b/src/rich_codex/rich_img.py index e7cfa91..550906e 100644 --- a/src/rich_codex/rich_img.py +++ b/src/rich_codex/rich_img.py @@ -497,7 +497,11 @@ def save_images(self): for filename in self.img_paths: # Make directories if necessary - Path(filename).parent.mkdir(parents=True, exist_ok=True) + try: + Path(filename).parent.mkdir(parents=True, exist_ok=True) + except OSError: + log.error(f"Invalid path: {filename}") + continue # If already made this image, copy it from the last destination if filename.lower().endswith(".png") and png_img is not None: