aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/cache.py
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/cache.py')
-rw-r--r--yt_dlp/cache.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/yt_dlp/cache.py b/yt_dlp/cache.py
index 0cac3ee88..e3f8a7dab 100644
--- a/yt_dlp/cache.py
+++ b/yt_dlp/cache.py
@@ -1,3 +1,4 @@
+import contextlib
import errno
import json
import os
@@ -57,7 +58,7 @@ class Cache:
return default
cache_fn = self._get_cache_fn(section, key, dtype)
- try:
+ with contextlib.suppress(OSError):
try:
with open(cache_fn, encoding='utf-8') as cachef:
self._ydl.write_debug(f'Loading {section}.{key} from cache')
@@ -68,8 +69,6 @@ class Cache:
except OSError as oe:
file_size = str(oe)
self._ydl.report_warning(f'Cache retrieval from {cache_fn} failed ({file_size})')
- except OSError:
- pass # No cache available
return default