Ammon Riley added the comment:
You can replace the built-in open(), with one of your own devising:
>>> import shutil
>>> def open(*a, **k):
... raise IOError("faked error.")
...
>>> __builtins__.open = open
>>> shuti
New submission from Ammon Riley <[EMAIL PROTECTED]>:
If the disk fills up during the copy operation, shutil.copyfile() leaks
file descriptors.
The problem is the order of the close() statements in the finally block.
In the event the copy operation runs out of disk space, the fdst.close(