From 22128cf572cc2427c67a0364984f4ee06dd01add Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Fri, 10 Mar 2017 13:10:29 -0500 Subject: [PATCH] use isdir instead of exists in makedirs --- peru/compat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/peru/compat.py b/peru/compat.py index 74d8cbe..ca4fd6e 100644 --- a/peru/compat.py +++ b/peru/compat.py @@ -14,7 +14,8 @@ def makedirs(path): path exists with non-default permissions. This isn't fixed until 3.4. Pathlib won't be getting an exist_ok param until 3.5.''' path = str(path) # compatibility with pathlib - if not os.path.exists(path): + # Use isdir to avoid silently returning if the path exists but isn't a dir. + if not os.path.isdir(path): os.makedirs(path)