[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^
Daniel Plachotich
report at bugs.python.org
Mon Nov 9 05:43:43 EST 2015
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 <report at bugs.python.org>
<http://bugs.python.org/issue25583>
_______________________________________
More information about the Python-bugs-list
mailing list