From 7390514877329c9a2bd3b3c0d44f08e7d8733591 Mon Sep 17 00:00:00 2001 From: Babak Farrokhi Date: Sun, 18 Feb 2018 07:36:37 +0330 Subject: [PATCH] Deal with failures to open input file (fixes #50) --- dnseval.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dnseval.py b/dnseval.py index f608457..5795270 100755 --- a/dnseval.py +++ b/dnseval.py @@ -284,8 +284,12 @@ def main(): with sys.stdin as flist: f = flist.read().splitlines() else: - with open(inputfilename, 'rt') as flist: - f = flist.read().splitlines() + try: + with open(inputfilename, 'rt') as flist: + f = flist.read().splitlines() + except Exception as e: + print(e) + sys.exit(1) else: f = resolvers if len(f) == 0: