[docs] [issue13498] os.makedirs exist_ok documentation is incorrect, as is some of the behavior
Hynek Schlawack
report at bugs.python.org
Tue Jul 31 11:23:45 CEST 2012
Hynek Schlawack added the comment:
So, IMHO if someone calls os.makedirs with a mode != 0o777, they expect to have the directories having those modes afterward. So raising no error if they exist and have the wrong mode would be a plain bug.
Python 3.3 already has a helpful error message:
FileExistsError: [Errno 17] File exists (mode 777 != expected mode 755): 'foo'
and it also handles the sticky issue gracefully: http://hg.python.org/cpython/file/3a08d766eee3/Lib/os.py#l270
So this are an non-issues for 3.3. I'm not sure if it's severe enough to be back ported to 3.2.
So there’s only one thing left: the docs are wrong and should be fixed about exist_ok's behavior for both 3.2 & 3.3.
That said, I see the rationale for fixing the permissions but we can't just change os.makedirs at this point.
So I'd propose to add a "fix_permissions" bool flag that would allow the "no matter what the state is now, I want dir x with permissions y, do whatever is necessary workflow."
Opinions?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13498>
_______________________________________
More information about the docs
mailing list