Commit 885cdd00 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

create_directories_safe: use the new exist_ok flag in os.makedirs.

parent 8c178351
Pipeline #38382 passed with stage
in 5 minutes and 21 seconds
......@@ -97,17 +97,10 @@ def create_directories_safe(directory, dryrun=False):
``dryrun`` : bool
Only ``print`` the command to console, but do not execute it.
if dryrun:
print("[dry-run] mkdir -p '%s'" % directory)
if directory and not os.path.exists(directory):
except OSError as exc: # Python >2.5
import errno
if exc.errno != errno.EEXIST:
if dryrun:
print("[dry-run] mkdir -p '%s'" % directory)
os.makedirs(directory, exist_ok=True)
def load(inputs):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment