From 71771d0217bc86000b31d4befc3386d5380dc60e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rostislav=20L=C3=A1n?= Date: Sun, 8 Jan 2023 22:55:49 +0100 Subject: [PATCH] Checks for input file existence first. --- src/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.py b/src/main.py index 07238af..4dd899b 100644 --- a/src/main.py +++ b/src/main.py @@ -7,6 +7,7 @@ import argparse as ap import sys import json +from os.path import exists # Libraries for image processing import numpy as np @@ -59,7 +60,11 @@ class apply_filters: self.output_file = self.args.output_file self.dpi = self.args.dpi self.mirror = True if self.args.mirror else False - self.run() + if exists(self.input_file): + self.run() + else: + print("Input file does not exist", file=sys.stderr) + exit(1) def run(self): # read as numpy.array