diff options
Diffstat (limited to 'Lib/os.py')
-rw-r--r-- | Lib/os.py | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -156,11 +156,17 @@ def makedirs(name, mode=0777): recursive. """ + from errno import EEXIST head, tail = path.split(name) if not tail: head, tail = path.split(head) if head and tail and not path.exists(head): - makedirs(head, mode) + try: + makedirs(head, mode) + except OSError, e: + # be happy if someone already created the path + if e.errno != EEXIST: + raise if tail == curdir: # xxx/newdir/. exists if xxx/newdir exists return mkdir(name, mode) |