ianaré added the comment:
Sorry about that. Here is the output from $ svn diff
I've also made modifications to allow to ignore the permission errors
(defaults to no) - should I post here or file new report?
Added file: http://bugs.python.org/file8876/shutil.diff
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1545>
__________________________________
Index: Lib/shutil.py
===================================================================
--- Lib/shutil.py (revision 59335)
+++ Lib/shutil.py (working copy)
@@ -9,6 +9,12 @@
import stat
from os.path import abspath
+# To ignore WindowsError on non-Windows systems
+try:
+ WindowsError
+except NameError:
+ WindowsError = None
+
__all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2",
"copytree","move","rmtree","Error"]
@@ -91,7 +97,14 @@
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
copyfile(src, dst)
- copystat(src, dst)
+ try:
+ copystat(src, dst)
+ except OSError, err:
+ # Copying file access times may fail on Windows
+ if WindowsError is not None and isinstance(err, WindowsError):
+ pass
+ else:
+ raise
def copytree(src, dst, symlinks=False):
@@ -131,11 +144,12 @@
errors.extend(err.args[0])
try:
copystat(src, dst)
- except WindowsError:
- # can't copy file access times on Windows
- pass
except OSError, why:
- errors.extend((src, dst, str(why)))
+ # Copying file access times may fail on Windows
+ if WindowsError is not None and isinstance(err, WindowsError):
+ pass
+ else:
+ errors.extend((src, dst, str(why)))
if errors:
raise Error, errors
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com