Eryk Sun <eryk...@gmail.com> added the comment:
I can help, but in this case there isn't much to do. Just replace os.rename() with os.replace(), make a minor doc change, and maybe add a test that ensures a junction can be moved over an existing file on the same filesystem. For example: >>> os.mkdir('temp') >>> _winapi.CreateJunction('temp', 'src') >>> os.lstat('src').st_reparse_tag == stat.IO_REPARSE_TAG_MOUNT_POINT True >>> open('dst', 'w').close() The current implementation tries copytree() on the junction mountpoint and fails to create a new directory named "dst": >>> try: shutil.move('src', 'dst') ... except FileExistsError as e: e ... FileExistsError(17, 'Cannot create a file when that file already exists') But move() should simply replace "dst" with the junction via os.replace(): >>> os.replace('src', 'dst') >>> os.lstat('dst').st_reparse_tag == stat.IO_REPARSE_TAG_MOUNT_POINT True ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42929> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com