Message231612
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.) |
|
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 | |
|