From baeb9e59f9152751210599b18925194578fb6a12 Mon Sep 17 00:00:00 2001 From: Yogesh Agarwala Date: Sat, 23 Mar 2024 05:37:21 +0530 Subject: [PATCH] Fix bug in send2trash: Use os.fsdecode() in shutil.move() `shutil.move()` function expects string paths, not byte paths. This bug is leading to failure when src and dst are on on the different file system. --- send2trash/plat_other.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/send2trash/plat_other.py b/send2trash/plat_other.py index 517e2a0..ace7b13 100644 --- a/send2trash/plat_other.py +++ b/send2trash/plat_other.py @@ -115,7 +115,7 @@ def trash_move(src, dst, topdir=None, cross_dev=False): f.write(info_for(src, topdir)) destpath = op.join(filespath, destname) if cross_dev: - shutil.move(src, destpath) + shutil.move(fsdecode(src), fsdecode(destpath)) else: os.rename(src, destpath)