Repository navigation
Unclear documentation for shutil.copytree() #88513
Description
Activity
I donot understand this sentence:
"dirs_exist_ok dictates whether to raise an exception in case dst or any
missing parent directory already exists."How can a "missing parent directory already exist"?
My understanding would be that an existing
dstwould be OK (and copied into) but missing parent directories are just the ones abovedstthat also don't exist.Until 3.7, missing parent directories were documented to be auto-created (
mkdir -p-style) according to the documentation ("The destination directory, named by dst, must not already exist; it will be created as well as missing parent directories."). Was this feature really removed? If not, then this part was accidentally (?) dropped from documentation?What am I missing? I think, the documentation should be amended to make that clear.
- added3.8 (EOL)end of lifeend of life3.10 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of life
on Jun 8, 2021 - addeddocsDocumentation in the Doc dirDocumentation in the Doc dirtype-featureA feature request or enhancementA feature request or enhancement3.8 (EOL)end of lifeend of life3.10 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of life
on Jun 8, 2021 - addeddocsDocumentation in the Doc dirDocumentation in the Doc dirtype-featureA feature request or enhancementA feature request or enhancement
on Jun 8, 2021 From the code, this arg is simply passed to os.mkdirs() here:
Line 450 in e6e34e4
os.makedirs(dst, exist_ok=dirs_exist_ok) os.mkdir is documented here: https://docs.python.org/3/library/os.html#os.makedirs
and says just "If exist_ok is False (the default), an FileExistsError is raised if the target directory already exists."
So I agree that the sentence you highlighted can be improved.
Would you like to submit a patch?
- addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
on Jun 9, 2021 2 remaining items
- addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory3.11only security fixesonly security fixesand removed3.8 (EOL)end of lifeend of life
on Jun 9, 2021 I would like to submit a patch for this. This would be my first contribution :)
I am starting on a patch now.
I've created a PR: #26634
I forgot to put a news entry, but hopefully that's ok since this is a very small change.
#91434 was merged to address this. Thanks for your contribution @jdevries3133! I'll close this issue once the backports (#91464, #91465) are merged.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: