[issue9299] os.mkdir() and os.makedirs() add a keyword argument to suppress "File exists" exception.

Terry J. Reedy report at bugs.python.org
Wed Jul 21 23:04:40 CEST 2010

Terry J. Reedy <tjreedy at udel.edu> added the comment:

Guido: "Hm. I wonder if os.mkdir() should not be left alone (so as to continue to match the system call most exactly, as is our convention) and the extra functionality added to os.makedirs() only."

Sticking with that convention seems like a good idea. That would imply wrapping the mkdir call within makedirs as something like

except (<errs to be caught>:
  if not exist_ok:

mkdir could be changed in the future but not unchanged once changed.

Ray, can you make a simplified patch that leaves posixmodule.c alone, and make sure it passes the old and new tests? I am 99% sure some version will be applied for 3.2.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list