New submission from Ray.Allen <ysj....@gmail.com>:

As discussed in python-dev mailing list, something should be add to os.mkdir() 
and os.makedirs() to simulate the shell's "mkdir -p" function, that is, 
suppress the OSError exception if the target directory exists. 

Here is a patch against py3k, with code, test and doc. I add an "ensure_exist" 
keyword argument for both os.mkdir() and os.makedirs(), indicates weather an 
OSError is raised if the target directory already exists.

Since I've no windows environment, I only tested the patch on Unix. Hope 
someone could help test it on windows.

----------
components: Library (Lib)
files: mkdir_py3k.diff
keywords: patch
messages: 110719
nosy: ysj.ray
priority: normal
severity: normal
status: open
title: os.mkdir() and os.makedirs() add a keyword argument to suppress "File 
exists" exception.
versions: Python 2.7, Python 3.3
Added file: http://bugs.python.org/file18059/mkdir_py3k.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9299>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to