Daniel Plachotich added the comment:
Maybe the solution is to leave OSError catching after the conditional
(probably with some additional comments):
if not (exist_ok and path.isdir(name)):
try:
mkdir(name, mode)
except OSError as e:
if not exist_ok or e.errno != errno.EEXIST or not path.isdir(name):
raise
This should solve the problem. It also gives more or less guarantee
that errno will be EEXIST, while the current code will also raise an exception
on EROFS (read-only FS), ENOSPC (no space left) in addition to EACCES on Windows
(and possibly some other values on various systems - who knows?).
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue25583>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com