From aed908fc70b3923aa07efd522497d848b6aeccd8 Mon Sep 17 00:00:00 2001 From: Christovis Date: Tue, 4 May 2021 08:27:23 +0100 Subject: [PATCH] use os.path.isdir instead of catching error --- bigbang/listserv.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bigbang/listserv.py b/bigbang/listserv.py index 240be3f1..4e851c14 100644 --- a/bigbang/listserv.py +++ b/bigbang/listserv.py @@ -987,10 +987,8 @@ def from_mailing_lists( if len(mlist) != 0: if instant_save: dir_out = CONFIG.mail_path + name - try: + if os.path.isdir(dir_out) is False: os.mkdir(dir_out) - except FileExistsError: - pass # temporary directory already exists, that's cool mlist.to_mbox(dir_out=dir_out) else: logger.info(f"Recorded the list {mlist.name}.") @@ -1087,10 +1085,8 @@ def get_lists_from_url( if len(mlist) != 0: if instant_save: dir_out = CONFIG.mail_path + name - try: + if os.path.isdir(dir_out) is False: os.mkdir(dir_out) - except FileExistsError: - pass # temporary directory already exists, that's cool mlist.to_mbox(dir_out=CONFIG.mail_path) archive.append(mlist.name) else: