Project

General

Profile

Actions

Bug #273

closed

Python shutil.copytree() failing

Added by dandar3 over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Python Code and/or Scripts
Target version:
Start date:
21/12/2013
Due date:
% Done:

0%

Resolution:
fixed
Affected Version:

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

shutil.copytree.test.py (190 Bytes) shutil.copytree.test.py dandar3, 21/12/2013 04:27 PM
xbmc.log (69.8 KB) xbmc.log dandar3, 21/12/2013 04:27 PM
Actions #2

Updated by buzz over 10 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.

Actions

Also available in: Atom PDF