File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 29
29
def _mkdir_p (path ):
30
30
"""Creates a directory, and any necessary parents.
31
31
32
- This implementation based on a Stack Overflow question that can be found here:
33
- https://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python
34
-
35
32
If the path provided is an existing file, this function raises an exception.
36
33
:param path: The directory name that should be created.
37
34
"""
38
35
if not path :
39
36
return # NO-OP
40
37
41
38
if sys .version_info >= (3 , 2 ):
42
- # Can just use the standard Python functionality if it's recent enough (and the
43
- # manual handling below can be dropped altogether when Python 2 support goes)
44
- return os .makedirs (path , exist_ok = True )
39
+ os .makedirs (path , exist_ok = True )
40
+ return
45
41
42
+ # This fallback implementation is based on a Stack Overflow question:
43
+ # https://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python
44
+ # Known issue: it won't work when the path is a root folder like "C:\\"
46
45
try :
47
46
os .makedirs (path )
48
47
except OSError as exp :
You can’t perform that action at this time.
0 commit comments