This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author garrison
Recipients garrison
Date 2014-05-20.03:53:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
As of Python 3.2, `os.makedirs()` takes `exist_ok` as a keyword argument.  If set to true, the function does not raise an error if the directory already exists.  This makes the function's behavior similar to `mkdir -p` on the UNIX commandline.  (See

However, this functionality is missing in Python's new pathlib. In fact, the documentation for `Path.mkdir()` even mentions that if `parent=True` is passed, then it should behave like `mkdir -p`.  This is accurate in that it indeed recursively makes any parent directories necessary, but it is inaccurate in that it raises an error if the directory already exists.

I propose that either `parents=True` should imply that there is no error if the directory already exists (which would be a backwards-incompatible change); or, there could be a new `exist_ok=True`, which could suppress the error for an existing directory.  Either way, it ought to be possible to get the `mkdir -p` functionality easily from pathlib.  And the documentation for `Path.mkdir()` should be updated to explain how to get this `mkdir -p` functionality, with the existing (inaccurate) `mkdir -p` mention removed.
Date User Action Args
2014-05-20 03:53:56garrisonsetrecipients: + garrison
2014-05-20 03:53:56garrisonsetmessageid: <>
2014-05-20 03:53:56garrisonlinkissue21539 messages
2014-05-20 03:53:55garrisoncreate