Message386641
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 |
|
Date |
User |
Action |
Args |
2021-02-08 18:18:32 | milanbalazs | set | recipients:
+ milanbalazs, serhiy.storchaka |
2021-02-08 18:18:32 | milanbalazs | set | messageid: <1612808312.27.0.380842052208.issue43165@roundup.psfhosted.org> |
2021-02-08 18:18:32 | milanbalazs | link | issue43165 messages |
2021-02-08 18:18:32 | milanbalazs | create | |
|