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/cache.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'yt_dlp/cache.py') diff --git a/yt_dlp/cache.py b/yt_dlp/cache.py index 7be91eae5..f8344fe77 100644 --- a/yt_dlp/cache.py +++ b/yt_dlp/cache.py @@ -39,11 +39,7 @@ class Cache: fn = self._get_cache_fn(section, key, dtype) try: - try: - os.makedirs(os.path.dirname(fn)) - except OSError as ose: - if ose.errno != errno.EEXIST: - raise + os.makedirs(os.path.dirname(fn), exist_ok=True) self._ydl.write_debug(f'Saving {section}.{key} to cache') write_json_file({'yt-dlp_version': __version__, 'data': data}, fn) except Exception: -- cgit v1.2.3