[issue22107] tempfile module misinterprets access denied error on Windows
Mark Lawrence
report at bugs.python.org
Sat Feb 14 23:51:27 CET 2015
Mark Lawrence added the comment:
changeset 035b61b52caa has this:-
return (fd, _os.path.abspath(file))
except FileExistsError:
continue # try again
+ except PermissionError:
+ # This exception is thrown when a directory with the chosen name
+ # already exists on windows.
+ if _os.name == 'nt':
+ continue
+ else:
+ raise
raise FileExistsError(_errno.EEXIST,
"No usable temporary file name found")
Could we simply set a flag saying it's a PermissionError and then raise the appropriate PermissionError or FileExistsError at the end of the loop?
----------
nosy: +BreamoreBoy, steve.dower, tim.golden, zach.ware
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22107>
_______________________________________
More information about the Python-bugs-list
mailing list