Bug #273
closedPython shutil.copytree() failing
0%
Description
Python shutil.copytree() is failing on 3.5 DEV (Python 2.7), it works fine in earlier 3.3.3 (Python 2.4).
Test script attached (save in Q:\scripts) - it copies recursively Q:\UserData into F:\Temp\UserData.
Interestingly enough it does copy the files judging by the size of the destination.
Reported by a user when using XBMC4Xbox Installer plugin with latest nightlies.
http://www.xbmc4xbox.org.uk/forum/viewtopic.php?f=7&t=2053&p=17030
Files
Updated by dandar3 almost 11 years ago
- File shutil.copytree.test.py shutil.copytree.test.py added
- File xbmc.log xbmc.log added
Updated by buzz almost 11 years ago
- Status changed from New to Closed
- Assignee set to buzz
- Target version set to 3.5
- Resolution set to fixed
Thanks for the excellent bug report and example code. Makes things much easier to start debugging.
Fixed in r32644
the python 2.4 shutil.copytree did a utime (to set file time) only on files. All worked fine.
on the python 2.7 shutil.copytree, it does it on files, and then it tries to do a copystat again (no matter if it had already done it - not very well written!). It then has some code to check for a windowserror, and ignore if so, or throw the error. On unix directories act like files and you can do utime on them. This doesn't work on windows though, nor our system. As our python platform is rather hybrid/custom, this code will throw the error for us. I decided to put the fix in at the python posix call level, making it only do a utime for actual files. This should improve compatibility, and means any other code that would try this and fail will now work too.