Commit a7ceeb33 authored by Brett Cannon's avatar Brett Cannon

OSError is the exception raised when one tries to create a directory that

already exists, not IOError.

Part of the continuing saga of issue #9572.
parent 81675618
...@@ -493,13 +493,16 @@ class _SourceFileLoader(_FileLoader, SourceLoader): ...@@ -493,13 +493,16 @@ class _SourceFileLoader(_FileLoader, SourceLoader):
parent = _path_join(parent, part) parent = _path_join(parent, part)
try: try:
_os.mkdir(parent) _os.mkdir(parent)
except IOError as exc: except OSError as exc:
# Probably another Python process already created the dir. # Probably another Python process already created the dir.
if exc.errno == errno.EEXIST: if exc.errno == errno.EEXIST:
continue continue
else:
raise
except IOError as exc:
# If can't get proper access, then just forget about writing # If can't get proper access, then just forget about writing
# the data. # the data.
elif exc.errno == errno.EACCES: if exc.errno == errno.EACCES:
return return
else: else:
raise raise
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment