From: Brett Cannon Date: Thu, 26 Aug 2010 21:07:13 +0000 (+0000) Subject: OSError is the exception raised when one tries to create a directory that X-Git-Tag: v3.2a2~130 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a7ceeb335f231269e7905597e6bd15ff0e302bd0;p=python 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. --- diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 5566b78bf0..9130a928e8 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -493,13 +493,16 @@ class _SourceFileLoader(_FileLoader, SourceLoader): parent = _path_join(parent, part) try: _os.mkdir(parent) - except IOError as exc: + except OSError as exc: # Probably another Python process already created the dir. if exc.errno == errno.EEXIST: continue + else: + raise + except IOError as exc: # If can't get proper access, then just forget about writing # the data. - elif exc.errno == errno.EACCES: + if exc.errno == errno.EACCES: return else: raise