Milan Balazs <[email protected]> added the comment:
Sure, you can use try/except but it would be nice if the "shutil.copyfile"
function supports the same files.
If I have many files (more thousand), I don't want to check them with a
try/except.
Furthermore if I want to cover the unexpected exceptions as well I need to use
nested try/except (I guess it's not the most elegant way).
Eg.:
try:
shutil.copyfile("test.txt", "test.txt")
except SameFileError:
pass
except Exception as unexpected_exception:
raise unexpected_exception
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43165>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com