From a8f408941a37f406dc009357904f76a8e804d481 Mon Sep 17 00:00:00 2001 From: MG-5 Date: Tue, 25 Oct 2022 00:02:53 +0200 Subject: [PATCH] Add catching for invalid file input --- edit_data_form.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/edit_data_form.py b/edit_data_form.py index 7fda31b..605f18c 100755 --- a/edit_data_form.py +++ b/edit_data_form.py @@ -80,6 +80,10 @@ def main(*_args): filesList.sort() file_path = os.path.join(file_path, filesList[len(filesList) - 1]) + else: + print("Please enter a valid json file or the directory containing the json file!") + sys.exit(0) + else: file_path = pathlib.Path(pathlib.Path(__file__).absolute().parent, 'example.json')