From 22f656b800c66cd189e8f039b680b92bb3464122 Mon Sep 17 00:00:00 2001 From: Steve Nixon Date: Mon, 11 Apr 2022 22:47:50 -0700 Subject: [PATCH 1/2] Adding check for valid output path --- video2x/video2x.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/video2x/video2x.py b/video2x/video2x.py index 3c165fd..379ea12 100755 --- a/video2x/video2x.py +++ b/video2x/video2x.py @@ -586,6 +586,11 @@ def main() -> int: if not args.input.is_file(): logger.critical("Input path is not a file") return 1 + + # Output file won't exist yet, but the parent directory should. + if not args.output.parent.exists(): + logger.critical(f"Output directory does not exist: {args.output}") + return 1 # set logger level if os.environ.get("LOGURU_LEVEL") is None: From a1d750e7ca4b8b8cd8b46ba199cbb1527fab507c Mon Sep 17 00:00:00 2001 From: K4YT3X Date: Thu, 14 Apr 2022 03:33:22 +0000 Subject: [PATCH 2/2] combined output dir check with the previous section --- video2x/video2x.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/video2x/video2x.py b/video2x/video2x.py index 379ea12..a24c063 100755 --- a/video2x/video2x.py +++ b/video2x/video2x.py @@ -586,10 +586,8 @@ def main() -> int: if not args.input.is_file(): logger.critical("Input path is not a file") return 1 - - # Output file won't exist yet, but the parent directory should. if not args.output.parent.exists(): - logger.critical(f"Output directory does not exist: {args.output}") + logger.critical(f"Output directory does not exist: {args.output.parent}") return 1 # set logger level