#13498: Clarify docs of os.makedirs()'s exist_ok argument.
authorHynek Schlawack <hs@ox.cx>
Sun, 7 Oct 2012 16:04:38 +0000 (18:04 +0200)
committerHynek Schlawack <hs@ox.cx>
Sun, 7 Oct 2012 16:04:38 +0000 (18:04 +0200)
Done with great native-speaker help from R. David Murray.

Doc/library/os.rst
Misc/NEWS

index 5991e29de577ff3934075553179d98e358f09cac..410e03a495696840c15f4b38855cf0d1ec2f6a7c 100644 (file)
@@ -1183,18 +1183,21 @@ Files and Directories
       single: UNC paths; and os.makedirs()
 
    Recursive directory creation function.  Like :func:`mkdir`, but makes all
-   intermediate-level directories needed to contain the leaf directory.  If
-   the target directory with the same mode as specified already exists,
-   raises an :exc:`OSError` exception if *exist_ok* is False, otherwise no
-   exception is raised.  If the directory cannot be created in other cases,
-   raises an :exc:`OSError` exception.  The default *mode* is ``0o777`` (octal).
-   On some systems, *mode* is ignored.  Where it is used, the current umask
-   value is first masked out.
+   intermediate-level directories needed to contain the leaf directory.
+
+   The default *mode* is ``0o777`` (octal).  On some systems, *mode* is
+   ignored.  Where it is used, the current umask value is first masked out.
+
+   If *exists_ok* is ``False`` (the default), an :exc:`OSError` is raised if
+   the target directory already exists.  If *exists_ok* is ``True`` an
+   :exc:`OSError` is still raised if the umask-masked *mode* is different from
+   the existing mode, on systems where the mode is used.  :exc:`OSError` will
+   also be raised if the directory creation fails.
 
    .. note::
 
       :func:`makedirs` will become confused if the path elements to create
-      include :data:`pardir`.
+      include :data:`pardir` (eg. ".." on UNIX systems).
 
    This function handles UNC paths correctly.
 
index 5cd69b415276fef2b6b3a378bad7b5f334285dfa..409c1f36e13ccb08a7280c0e8d58721c7dcc9db6 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -609,6 +609,9 @@ Build
 Documentation
 -------------
 
+- Issue #13498: Clarify docs of os.makedirs()'s exist_ok argument.  Done with
+  great native-speaker help from R. David Murray.
+
 - Issue #15533: Clarify docs and add tests for subprocess.Popen()'s cwd
   argument.