From 6672e8d1d2ad85c322ab85da2e8f3203b7e0b007 Mon Sep 17 00:00:00 2001 From: waldek Date: Mon, 24 May 2021 17:24:46 +0200 Subject: [PATCH] test wether the file exists before opening --- standalone_tui.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/standalone_tui.py b/standalone_tui.py index 9fdd613..1e27020 100755 --- a/standalone_tui.py +++ b/standalone_tui.py @@ -125,6 +125,9 @@ if __name__ == "__main__": parser.add_argument("-n", "--number", default=10, help="number of questions to ask", type=int, action="store") args = parser.parse_args() filepath = pathlib.Path(args.file) + if not filepath.exists(): + print("no such file!") + exit(1) interface = Tui() app = Application(filepath, interface, args.number) try: