[ python-Bugs-1525866 ] Bug in shutil.copytree on Windows

SourceForge.net noreply at sourceforge.net
Thu Jul 20 18:14:24 CEST 2006


Bugs item #1525866, was opened at 2006-07-20 15:00
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1525866&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Mike Foord (mjfoord)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bug in shutil.copytree on Windows

Initial Comment:
The problem is that the call to 'copystat(src, dst)'
was added to the shutil.copytree function, in svn
r38363 probably.  It will fail always on Windows, since
os.utime does not work on directories.

I guess that a patch similar to this one should fix it:

Index: shutil.py
===================================================================
--- shutil.py	(Revision 50710)
+++ shutil.py	(Arbeitskopie)
@@ -127,7 +127,12 @@
         # continue with other files
         except Error, err:
             errors.extend(err.args[0])
-    copystat(src, dst)
+    try:
+        copystat(src, dst)
+    except WindowsError:
+        pass
+    except OSError, err:
+        errors.extend(err.args[0])
     if errors:
         raise Error, errors

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2006-07-20 18:14

Message:
Logged In: YES 
user_id=21627

Can you also come up with a patch to the test suite?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1525866&group_id=5470


More information about the Python-bugs-list mailing list