From d63f72634793731b2079f9d6f57506374156a9d6 Mon Sep 17 00:00:00 2001 From: Fenhl Date: Sat, 14 Oct 2023 01:24:25 +0000 Subject: [PATCH] Fix race condition creating log directory --- OoTRandomizer.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OoTRandomizer.py b/OoTRandomizer.py index bcae004d5..580ec6ef2 100755 --- a/OoTRandomizer.py +++ b/OoTRandomizer.py @@ -26,8 +26,7 @@ def start() -> None: ts = time.time() st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H-%M-%S') log_dir = local_path('Logs') - if not os.path.exists(log_dir): - os.makedirs(log_dir) + os.makedirs(log_dir, exist_ok=True) log_path = os.path.join(log_dir, '%s.log' % st) log_file = logging.FileHandler(log_path) log_file.setFormatter(logging.Formatter('[%(asctime)s] %(message)s', datefmt='%H:%M:%S'))