Cope with PermissionError.

This commit is contained in:
Jelmer Vernooij 2021-05-16 17:18:51 +01:00
parent 36c331bffe
commit bfd8331121

View file

@ -156,7 +156,12 @@ def load_apt_cache_file(url, cache_dir):
import lz4.frame
return lz4.frame.open(p, mode="rb")
return _unwrap(open(p, "rb"), ext)
try:
f = open(p, "rb")
except PermissionError as e:
logging.warning('Unable to open %s: %s', p, e)
raise FileNotFoundError(url)
return _unwrap(f, ext)
raise FileNotFoundError(url)