New submission from Milan Balazs <[email protected]>:
The "shutil.copyfile" raises a "SameFileError" exception if the src and dts
files are the same.
There is no option to allow the same files(like in case of
shutil.copytree(dirs_exist_ok=False)).
For example:
import shutil
shutil.copyfile("test.txt", "test.txt")
Output:
>>> python3 test.py
Traceback (most recent call last):
File "test.py", line 3, in <module>
shutil.copyfile("test.txt", "test.txt")
File "/usr/lib/python3.6/shutil.py", line 104, in copyfile
raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
shutil.SameFileError: 'test.txt' and 'test.txt' are the same file
----------
components: Library (Lib)
messages: 386634
nosy: milanbalazs
priority: normal
severity: normal
status: open
title: Support the same files with new param in shutil.copyfile
type: enhancement
versions: Python 3.10
_______________________________________
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