Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a7ceeb3

Browse files
committed
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.
1 parent 8167561 commit a7ceeb3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Lib/importlib/_bootstrap.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,16 @@ def set_data(self, path, data):
493493
parent = _path_join(parent, part)
494494
try:
495495
_os.mkdir(parent)
496-
except IOError as exc:
496+
except OSError as exc:
497497
# Probably another Python process already created the dir.
498498
if exc.errno == errno.EEXIST:
499499
continue
500+
else:
501+
raise
502+
except IOError as exc:
500503
# If can't get proper access, then just forget about writing
501504
# the data.
502-
elif exc.errno == errno.EACCES:
505+
if exc.errno == errno.EACCES:
503506
return
504507
else:
505508
raise

0 commit comments

Comments
 (0)