[issue9299] os.makedirs(): Add a keyword argument to suppress "File exists" exception

Ray.Allen report at bugs.python.org
Mon Jul 26 15:26:16 CEST 2010


Ray.Allen <ysj.ray at gmail.com> added the comment:

Oh, I'm sorry, I forgot about that case. 

I agree with Arfrever, we should suppress the OSError only if the target file exists as a directory, but not other types. That is, the "exist_ok" argument in makedirs() should mean "dir existing is ok", only existing of the exact same thing as we specified to create is ok, not other things. I will fixed this later. 

Besides, I wonder what should we do if the target directory exists but with a different mode than we specified(if we specified the "mode" argument). I guess we should also raise the OSError because the existing thing is not the same as what we want.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9299>
_______________________________________


More information about the Python-bugs-list mailing list