Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.io.base
Commits
885cdd00
Commit
885cdd00
authored
Mar 26, 2020
by
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
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/io/base/__init__.py
View file @
885cdd00
...
...
@@ -97,17 +97,10 @@ def create_directories_safe(directory, dryrun=False):
``dryrun`` : bool
Only ``print`` the command to console, but do not execute it.
"""
try
:
if
dryrun
:
print
(
"[dry-run] mkdir -p '%s'"
%
directory
)
else
:
if
directory
and
not
os
.
path
.
exists
(
directory
):
os
.
makedirs
(
directory
)
except
OSError
as
exc
:
# Python >2.5
import
errno
if
exc
.
errno
!=
errno
.
EEXIST
:
raise
if
dryrun
:
print
(
"[dry-run] mkdir -p '%s'"
%
directory
)
else
:
os
.
makedirs
(
directory
,
exist_ok
=
True
)
def
load
(
inputs
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment