[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-14 Thread Daniel Plachotich
Daniel Plachotich added the comment: Looks good to me. Without the fix, the test fails on Windows 7 as expected. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-10 Thread Daniel Plachotich
Daniel Plachotich added the comment: Yes, it's probably a better solution. If had been more careful, I wouldn't have scribbled so much text here :) . But is there any sense in adding Windows-specific test with EACCES since the problem with errno may affect other platforms as well (at least

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-09 Thread Daniel Plachotich
Daniel Plachotich added the comment: You mean msg254341? As I mentioned recently, it still will raise an exception in case of EROFS, ENOSPC and possibly other values, which, as in the case with Windows, can be quite unexpected depending on platform and circumstances. Of course

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-09 Thread Daniel Plachotich
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

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-08 Thread Daniel Plachotich
New submission from Daniel Plachotich: Since Windows 7 (or even Vista), Windows gives permission error(5, ERROR_ACCESS_DENIED if you try to create a directory in a drive root with the same name as a drive itself, even if you have administrative permissions. This behavior is not mentioned

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-08 Thread Daniel Plachotich
Daniel Plachotich added the comment: Probably better solution: if not (exist_ok and path.isdir(name) and e.errno in (errno.EEXIST, errno.EACCES)): -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-08 Thread Daniel Plachotich
Daniel Plachotich added the comment: Of course in examples I create '.' by hand, but in real code such things are mostly automatic. Assume, for example, that you have a function for downloading files: def download_file(url, save_as): ... # Before saving, you must ensure that path exists

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-08 Thread Daniel Plachotich
Daniel Plachotich added the comment: I meant x1.3 times faster on Linux :) -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue25583] os.makedirs with exist_ok=True raises PermissionError on Windows 7^

2015-11-08 Thread Daniel Plachotich
Daniel Plachotich added the comment: Of course, exist_ok must be taken into account: if not (exist_ok and path.isdir(name)): mkdir(name, mode) -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i