summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 5ee3d4b..35f97fb 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -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)