Index: shutil.py =================================================================== --- shutil.py (revision xxxxx) +++ shutil.py (working copy) @@ -7,6 +7,7 @@ import os import sys import stat +import exceptions from os.path import abspath __all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2", @@ -15,6 +16,13 @@ class Error(EnvironmentError): pass +# Make sure shutil_WindowsError is defined even if there is no such +# thing as WindowsError because copytree references it whenever +# copystat fails, regardless of the OS. +class NeverThrownException(Exception): + pass +shutil_WindowsError = exceptions.__dict__.get('WindowsError', NeverThrownException) + def copyfileobj(fsrc, fdst, length=16*1024): """copy data from file-like object fsrc to file-like object fdst""" while 1: @@ -129,7 +137,7 @@ errors.extend(err.args[0]) try: copystat(src, dst) - except WindowsError: + except shutil_WindowsError: # can't copy file access times on Windows pass except OSError, why: