summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
16dcfb8)
Calling create_dirs with an absolute path caused infinite recursion,
since os.path.dirname('/') == '/'. Fix this by exiting early if the
given path already is a directory.
def create_dirs(directory):
"""Create the given directory, if the path doesn't already exist."""
def create_dirs(directory):
"""Create the given directory, if the path doesn't already exist."""
+ if directory and not os.path.isdir(directory):
create_dirs(os.path.dirname(directory))
try:
os.mkdir(directory)
create_dirs(os.path.dirname(directory))
try:
os.mkdir(directory)