Skip to content

Commit d474dbf

Browse files
committed
Suppress errors for os.makedirs(), again.
This is a bit more nuanced in Python 3, where only EEXIST errors are suppressed, to match the `delete` codepath.
1 parent 4872bb9 commit d474dbf

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

cachecontrol/caches/file_cache.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
except NameError:
1616
# py2.X
1717
FileNotFoundError = (IOError, OSError)
18-
18+
FileExistsError = (IOError, OSError)
1919

2020
logger = logging.getLogger(__name__)
2121

@@ -130,10 +130,8 @@ def set(self, key, value):
130130
parentdir = os.path.dirname(name)
131131
try:
132132
os.makedirs(parentdir, self.dirmode)
133-
except (IOError, OSError):
134-
logging.debug(
135-
"Error trying to create directory '%s'", parentdir, exc_info=True
136-
)
133+
except FileExistsError:
134+
pass
137135

138136
with self.lock_class(name) as lock:
139137
# Write our actual file

0 commit comments

Comments
 (0)