From b25d6cb96337d479bdcb41768356da414c3aa835 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Fri, 17 Feb 2023 04:29:32 +0100 Subject: [utils] Fix race condition in `make_dir` (#6089) Authored by: aionescu --- yt_dlp/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'yt_dlp/utils.py') diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 2d9e61c5b..736468aef 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -5370,8 +5370,8 @@ def random_uuidv4(): def make_dir(path, to_screen=None): try: dn = os.path.dirname(path) - if dn and not os.path.exists(dn): - os.makedirs(dn) + if dn: + os.makedirs(dn, exist_ok=True) return True except OSError as err: if callable(to_screen) is not None: -- cgit v1.2.3