forked from mindspore-Ecosystem/mindspore
!467 Fix bug: Using safe way to create directory in Python code
Merge pull request !467 from candanzg/bug_for_makedirs
This commit is contained in:
commit
717ed427b2
|
@ -87,7 +87,7 @@ def _make_directory(path: str):
|
|||
# All exceptions need to be caught because create directory maybe have some limit(permissions)
|
||||
logger.debug("The directory(%s) doesn't exist, will create it", path)
|
||||
try:
|
||||
os.makedirs(path)
|
||||
os.makedirs(path, exist_ok=True)
|
||||
real_path = path
|
||||
except PermissionError as e:
|
||||
logger.error("No write permission on the directory(%r), error = %r", path, e)
|
||||
|
|
Loading…
Reference in New Issue