When shutil.copytree has been called recursively and catches an error from copy2 it adds the message to the errors list, then continues to copy the remaining items in that directory. This is good. At the end of the directory, however it raises an Error which escapes all the way back to the original caller. As a result the remaining contents of any parent directories do not get copied. The attached patch adds an "except Error" on the try surrounding the recursive call. Errors are accumulated then the copy continues. The result is that all files that can be copied do get copied and all files that cannot be copied are accumulated in the Error that ultimately is thrown to the caller. .
Logged In: YES user_id=1188172 The patch had an error in it: """except Error, errors""" Here "errors" is NOT the list of errors given as argument to the exception when raised with """raise Error, errors""". Apart from that, applied the change as Lib/shutil.py 1.37, 1.34.2.1.