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 Oz.Tiram
Recipients Oz.Tiram
Date 2022-01-09.14:52:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641739976.38.0.625892156687.issue46317@roundup.psfhosted.org>
In-reply-to
Content
Pathlib.rename will fail across file system with:

OSError: [Errno 18] Invalid cross-device link

e.g:
-> path_dict["current_path"].rename(path_dict["destination"])
(Pdb) n
OSError: [Errno 18] Invalid cross-device link: '/tmp/pipenv-k1m0oynt-yaml/PyYAML-6.0/lib/yaml' -> '/home/oz123/Software/pipenv/pipenv/patched/yaml3'

This is because it uses os.rename under the hood:
https://github.com/python/cpython/blob/3.10/Lib/pathlib.py#L306

One can either replace it with `shutil.move` which works, or one could
add another method to Pathlib.move(...) with similar signature and return value, which calls `shutil.move` under the hood.

Before submitting a patch for that, I would like to get feedback for that.
History
Date User Action Args
2022-01-09 14:52:56Oz.Tiramsetrecipients: + Oz.Tiram
2022-01-09 14:52:56Oz.Tiramsetmessageid: <1641739976.38.0.625892156687.issue46317@roundup.psfhosted.org>
2022-01-09 14:52:56Oz.Tiramlinkissue46317 messages
2022-01-09 14:52:56Oz.Tiramcreate