This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients milanbalazs, serhiy.storchaka
Date 2021-02-08.18:12:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612807927.19.0.0832776143601.issue43165@roundup.psfhosted.org>
In-reply-to
Content
You can use try/except.

try:
    shutil.copyfile("test.txt", "test.txt")
except SameFileError:
    pass
History
Date User Action Args
2021-02-08 18:12:07serhiy.storchakasetrecipients: + serhiy.storchaka, milanbalazs
2021-02-08 18:12:07serhiy.storchakasetmessageid: <1612807927.19.0.0832776143601.issue43165@roundup.psfhosted.org>
2021-02-08 18:12:07serhiy.storchakalinkissue43165 messages
2021-02-08 18:12:07serhiy.storchakacreate