report at bugs
Jun 16, 2012, 3:03 AM
Post #2 of 4
Hynek Schlawack <hs [at] ox> added the comment:
[issue15084] Add option to os.mkdir to not raise an exception for existing directories
[In reply to]
I looked into the code. Assuming it should be added, we're facing the fact that os.mkdir() is C code ATM and the handling of the error would require to implement it for NT and Unix separately.
Therefore it would make sense to add a Python os.mkdir() that handles this (basically try: _mkdir(dirname) except FileExistsError: pass) and make the C implementation private.
OTOH you could argue that if you just want to ensure that that a directory exists, you could just as well use os.makedirs() with exists_ok so I'm kind of -0 on the whole thing.
assignee: hynek ->
Python tracker <report [at] bugs>
Python-bugs-list mailing list