From 91a989a1724acfe86b6b7756510f79836949f83b Mon Sep 17 00:00:00 2001 From: AyluinReymaer <51486181+AyluinReymaer@users.noreply.github.com> Date: Sat, 29 Jun 2024 00:08:53 +0100 Subject: [PATCH 1/2] path.py - fix system cannot move file to different drive This fixes the below error message: OSError(18, 'The system cannot move the file to a different disk drive') --- gallery_dl/path.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gallery_dl/path.py b/gallery_dl/path.py index 1616bbda..ac3596f1 100644 --- a/gallery_dl/path.py +++ b/gallery_dl/path.py @@ -335,13 +335,10 @@ class PathFormat(): if self.temppath != self.realpath: # Move temp file to its actual location + os.makedirs(self.realdirectory, exist_ok=True) while True: try: os.replace(self.temppath, self.realpath) - except FileNotFoundError: - # delayed directory creation - os.makedirs(self.realdirectory) - continue except OSError: # move across different filesystems shutil.copyfile(self.temppath, self.realpath) From de61b3b546a770540c5bb04961817cfe6ec001f4 Mon Sep 17 00:00:00 2001 From: AyluinReymaer <51486181+AyluinReymaer@users.noreply.github.com> Date: Sat, 29 Jun 2024 00:58:03 +0100 Subject: [PATCH 2/2] Update path.py --- gallery_dl/path.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gallery_dl/path.py b/gallery_dl/path.py index ac3596f1..bfb6136f 100644 --- a/gallery_dl/path.py +++ b/gallery_dl/path.py @@ -335,13 +335,16 @@ class PathFormat(): if self.temppath != self.realpath: # Move temp file to its actual location - os.makedirs(self.realdirectory, exist_ok=True) while True: try: os.replace(self.temppath, self.realpath) except OSError: # move across different filesystems - shutil.copyfile(self.temppath, self.realpath) + try: + shutil.copyfile(self.temppath, self.realpath) + except FileNotFoundError: + os.makedirs(self.realdirectory) + shutil.copyfile(self.temppath, self.realpath) os.unlink(self.temppath) break