]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/cache.py
[ie/commonmistakes] Raise error on blob URLs (#9897)
[yt-dlp.git] / yt_dlp / cache.py
index 7be91eae5d33b57c72ef8d6616389202293a0595..9dd4f2f25b91a114cfb2ead8949e8fae654e8b69 100644 (file)
@@ -1,5 +1,4 @@
 import contextlib
-import errno
 import json
 import os
 import re
@@ -39,11 +38,7 @@ def store(self, section, key, data, dtype='json'):
 
         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: