[New-bugs-announce] [issue22933] Misleading sentence in doc for shutil.move

newbie report at bugs.python.org
Mon Nov 24 18:10:36 CET 2014


New submission from newbie:

First sentence of 3rd paragraph of 10.10. "shutil" documentation for shutil.move command, "The destination directory must not already exist", is misleading and contradicts other information in the entry.  I took it to mean that if dst did not exist, python would create it as a directory.  What actually happens is that python renames src to dst. In my test, I was moving several files to a new directory, and the result was a file with the pathname dst and contents matching the last move command, consistent with the behavior described in the rest of the paragraph and the following one. When I changed the code to create the directory with os.mkdirs before calling shutil.move, it worked as I wanted, so obviously there's nothing wrong with the destination directory already existing. The preceding paragraph implies this with its description of behavior when dst refers to a directory.  I suggest removing this sentence, and maybe adding some text indicating what to do if you want to move a file to a new directory.
I was using Python 2.7.5 on Windows, and branch 2.7.8 of the documentation (there does not appear to be a branch 2.7.5 available.)

----------
assignee: docs at python
components: Documentation
messages: 231612
nosy: docs at python, newbie
priority: normal
severity: normal
status: open
title: Misleading sentence in doc for shutil.move
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22933>
_______________________________________


More information about the New-bugs-announce mailing list