diff options
| author | 2025-01-28 19:12:09 -0500 | |
|---|---|---|
| committer | 2025-01-28 19:12:09 -0500 | |
| commit | a26df18796ff4e506b16bf32fcec9336233b9e2e (patch) | |
| tree | 876512f59831cd670a90a0bc92bc85def6ea3d82 /gallery_dl/path.py | |
| parent | 0532a387ef5b7fcb4507a9b094dca37a5f635fe1 (diff) | |
New upstream version 1.28.5.upstream/1.28.5
Diffstat (limited to 'gallery_dl/path.py')
| -rw-r--r-- | gallery_dl/path.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gallery_dl/path.py b/gallery_dl/path.py index f57b02e..21e1aa0 100644 --- a/gallery_dl/path.py +++ b/gallery_dl/path.py @@ -342,15 +342,22 @@ class PathFormat(): try: os.replace(self.temppath, self.realpath) except FileNotFoundError: - # delayed directory creation - os.makedirs(self.realdirectory) + try: + # delayed directory creation + os.makedirs(self.realdirectory) + except FileExistsError: + # file at self.temppath does not exist + return False continue except OSError: # move across different filesystems try: shutil.copyfile(self.temppath, self.realpath) except FileNotFoundError: - os.makedirs(self.realdirectory) + try: + os.makedirs(self.realdirectory) + except FileExistsError: + return False shutil.copyfile(self.temppath, self.realpath) os.unlink(self.temppath) break |
