Issue 1242454: shutil.copytree() quits too soon after an error. (original) (raw)

Issue1242454

Created on 2005-07-21 17:24 by dalewilson, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
shutil.patch dalewilson,2005-07-21 17:24 a patch to Python24/Lib/shutil.py
Messages (2)
msg48599 - (view) Author: Dale Wilson (dalewilson) Date: 2005-07-21 17:24
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. .
msg48600 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-08-31 22:50
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.
History
Date User Action Args
2022-04-11 14:56:12 admin set github: 42204
2005-07-21 17:24:16 dalewilson create