Message231612
| Author |
newbie |
| Recipients |
docs@python, newbie |
| Date |
2014年11月24日.17:10:35 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1416849036.72.0.766895523282.issue22933@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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.) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年11月24日 17:10:36 | newbie | set | recipients:
+ newbie, docs@python |
| 2014年11月24日 17:10:36 | newbie | set | messageid: <1416849036.72.0.766895523282.issue22933@psf.upfronthosting.co.za> |
| 2014年11月24日 17:10:36 | newbie | link | issue22933 messages |
| 2014年11月24日 17:10:35 | newbie | create |
|