From 358ac9acbbbb79b4983bfbdc6b9f1703aa6b05e8 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Tue, 28 Jan 2020 01:42:37 -0800 Subject: [PATCH] Move exception catch and return 1 back to main gitcheckup. --- gitcheckup.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gitcheckup.py b/gitcheckup.py index 9863d51..e9505ab 100644 --- a/gitcheckup.py +++ b/gitcheckup.py @@ -90,12 +90,8 @@ def checkup(directory, do_fetch=False): def read_directories_file(): directories_file = os.path.join(os.path.dirname(__file__), 'gitcheckup.txt') - try: - handle = open(directories_file, 'r') - except FileNotFoundError: - print(f'Please put your git repo locations in {directories_file}.') - return 1 + handle = open(directories_file, 'r') directories = handle.readlines() handle.close() @@ -105,7 +101,11 @@ def read_directories_file(): return directories def gitcheckup(do_fetch=False): - directories = read_directories_file() + try: + directories = read_directories_file() + except FileNotFoundError as exc: + print(f'Please put your git repo locations in {exc.filename}.') + return 1 for directory in directories: result = checkup(directory, do_fetch=do_fetch)