Attempting to copy a file to another location fails with a SameFileError:
draft @ pwd
C:\Users\jaraco\draft
draft @ cp z:\draft\mod.py .
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\jaraco\.local\bin\cp.exe\__main__.py", line 7, in <module>
File "C:\Users\jaraco\.local\pipx\venvs\cmdix\Lib\site-packages\cmdix\__init__.py", line 127, in run
return run_subcommand(commandname, argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jaraco\.local\pipx\venvs\cmdix\Lib\site-packages\cmdix\__init__.py", line 165, in run_subcommand
args.func(args)
File "C:\Users\jaraco\.local\pipx\venvs\cmdix\Lib\site-packages\cmdix\command\cp.py", line 59, in func
handle(_copy, args, args.DIRECTORY.pop(), src)
File "C:\Users\jaraco\.local\pipx\venvs\cmdix\Lib\site-packages\cmdix\command\cp.py", line 73, in handle
_copy(src, dstfile)
File "C:\Program Files\Python 3.12\Lib\shutil.py", line 423, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "C:\Program Files\Python 3.12\Lib\shutil.py", line 240, in copyfile
raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
shutil.SameFileError: 'z:\\draft\\mod.py' and 'z:\\draft\\mod.py' are the same file
draft @ cp z:\draft\mod.py c:\users\jaraco\draft
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\jaraco\.local\bin\cp.exe\__main__.py", line 7, in <module>
File "C:\Users\jaraco\.local\pipx\venvs\cmdix\Lib\site-packages\cmdix\__init__.py", line 127, in run
return run_subcommand(commandname, argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jaraco\.local\pipx\venvs\cmdix\Lib\site-packages\cmdix\__init__.py", line 165, in run_subcommand
args.func(args)
File "C:\Users\jaraco\.local\pipx\venvs\cmdix\Lib\site-packages\cmdix\command\cp.py", line 59, in func
handle(_copy, args, args.DIRECTORY.pop(), src)
File "C:\Users\jaraco\.local\pipx\venvs\cmdix\Lib\site-packages\cmdix\command\cp.py", line 73, in handle
_copy(src, dstfile)
File "C:\Program Files\Python 3.12\Lib\shutil.py", line 423, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "C:\Program Files\Python 3.12\Lib\shutil.py", line 240, in copyfile
raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
shutil.SameFileError: 'z:\\draft\\mod.py' and 'z:\\draft\\mod.py' are the same file
Attempting to copy a file to another location fails with a SameFileError: