summaryrefslogtreecommitdiffstats
path: root/Doc/library/os.rst
diff options
context:
space:
mode:
authorTerry Reedy <tjreedy@udel.edu>2010-12-02 07:05:56 (GMT)
committerTerry Reedy <tjreedy@udel.edu>2010-12-02 07:05:56 (GMT)
commit5a22b651173f142a600625a036fcf36484ade237 (patch)
tree35221434a0451ee9cf205f2e9dc17a69af69d596 /Doc/library/os.rst
parent3cdf871a8c9bc5694a598bfdf22edece49584f48 (diff)
downloadcpython-5a22b651173f142a600625a036fcf36484ade237.zip
cpython-5a22b651173f142a600625a036fcf36484ade237.tar.gz
cpython-5a22b651173f142a600625a036fcf36484ade237.tar.bz2
Issue 9299 Add exist_ok parameter to os.makedirs to suppress 'File exists' exception. Patch by Ray Allen.
Diffstat (limited to 'Doc/library/os.rst')
-rw-r--r--Doc/library/os.rst16
1 files changed, 11 insertions, 5 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index f3aad19..5d9a170 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1143,17 +1143,20 @@ Files and Directories
Availability: Unix, Windows.
-.. function:: makedirs(path[, mode])
+.. function:: makedirs(path[, mode][, exist_ok=False])
.. index::
single: directory; creating
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. Raises
- an :exc:`error` exception if the leaf directory already exists or cannot be
- created. 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. If
+ the target directory with the same mode as we 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.
.. note::
@@ -1162,6 +1165,9 @@ Files and Directories
This function handles UNC paths correctly.
+ .. versionadded:: 3.2
+ The *exist_ok* parameter.
+
.. function:: pathconf(path, name)