diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py index 101baced..87ca71ba 100644 --- a/gallery_dl/downloader/http.py +++ b/gallery_dl/downloader/http.py @@ -308,6 +308,9 @@ class HttpDownloader(DownloaderBase): # download content self.downloading = True with pathfmt.open(mode) as fp: + if fp is None: + # '.part' file no longer exists + break if file_header: fp.write(file_header) offset += len(file_header) diff --git a/gallery_dl/path.py b/gallery_dl/path.py index 1404b847..ff0c9649 100644 --- a/gallery_dl/path.py +++ b/gallery_dl/path.py @@ -171,6 +171,9 @@ class PathFormat(): try: return open(self.temppath, mode) except FileNotFoundError: + if "r" in mode: + # '.part' file no longer exists + return util.NullContext() os.makedirs(self.realdirectory) return open(self.temppath, mode)