Destination path '%s' already exists
Package:
pipenv
22232

Exception Class:
Error
Raise code
# We might be on a case insensitive filesystem,
# perform the rename anyway.
os.rename(src, dst)
return
real_dst = os.path.join(dst, _basename(src))
if os.path.exists(real_dst):
raise Error("Destination path '%s' already exists" % real_dst)
try:
os.rename(src, real_dst)
except OSError:
if os.path.isdir(src):
if _destinsrc(src, dst):
raise Error("Cannot move a directory '%s' into itself '%s'." % (src, dst))
copytree(src, real_dst, symlinks=True)
Links to the raise (2)
https://github.com/pypa/pipenv/blob/e7fb099e659a7fe661f0be9d4b1d05b681b6d562/pipenv/patched/notpip/_vendor/distlib/_backport/shutil.py#L327 https://github.com/pypa/pipenv/blob/e7fb099e659a7fe661f0be9d4b1d05b681b6d562/pipenv/vendor/distlib/_backport/shutil.py#L330See also in the other packages (1)
(❌️ No answer)
pip/destination-path-s-already-exists/
Ways to fix
Summary: solution depends on what you want to achieve. If you have files of the same name in both the source
and the destination folders, you can either overwrite the file in the destination with the file from the source
or move the file from the source and rename it so that both files still exist.
Code to reproduce (WRONG):
First, you have to create two files or directories of the same name. For example, i created two python files both
named asd.py, one in .../src directory, and one in .../dst directory.
from pipenv.vendor.distlib._backport import shutil
import os
shutil.move(f"{os.getcwd()}/src/asd.py", f"{os.getcwd()}/dst/")
This code with said files creates the exception.
Solution 1: leave both files, rename the file from src
from pipenv.vendor.distlib._backport import shutil
import os
shutil.move(f"{os.getcwd()}/src/asd.py", f"{os.getcwd()}/dst/asd2.py")
Solution 2: overwrite the file from dst with the file from src
from pipenv.vendor.distlib._backport import shutil
import os
shutil.move(f"{os.getcwd()}/src/asd.py", f"{os.getcwd()}/dst/asd.py")
Add a possible fix
Please authorize to post fix