diff -r aeb3faaf4754 Lib/tempfile.py --- a/Lib/tempfile.py Mon Sep 02 17:01:10 2013 -0700 +++ b/Lib/tempfile.py Tue Sep 03 13:16:09 2013 +0400 @@ -199,6 +199,13 @@ return (fd, _os.path.abspath(file)) except FileExistsError: continue # try again + except PermissionError: + # This exception is thrown when directory with chosen name + # already exists on windows. + if _os.name == 'nt': + continue + else: + raise raise FileExistsError(_errno.EEXIST, "No usable temporary file name found")