Check if parent directory of a file exists, raise OSError if it does not Parameters ---------- path: Path or str Path to check parent directory of
(path: Path | str)
| 643 | |
| 644 | |
| 645 | def check_parent_directory(path: Path | str) -> None: |
| 646 | """ |
| 647 | Check if parent directory of a file exists, raise OSError if it does not |
| 648 | |
| 649 | Parameters |
| 650 | ---------- |
| 651 | path: Path or str |
| 652 | Path to check parent directory of |
| 653 | """ |
| 654 | parent = Path(path).parent |
| 655 | if not parent.is_dir(): |
| 656 | raise OSError(rf"Cannot save file into a non-existent directory: '{parent}'") |
| 657 | |
| 658 | |
| 659 | @overload |
no outgoing calls
no test coverage detected