save cookies to tempfile, then rename
avoids wiping the cookies file if the disk is full
This commit is contained in:
@@ -431,8 +431,9 @@ class Extractor():
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(path, "w") as fp:
|
with open(path + ".tmp", "w") as fp:
|
||||||
util.cookiestxt_store(fp, self.cookies)
|
util.cookiestxt_store(fp, self.cookies)
|
||||||
|
os.replace(path + ".tmp", path)
|
||||||
except OSError as exc:
|
except OSError as exc:
|
||||||
self.log.warning("cookies: %s", exc)
|
self.log.warning("cookies: %s", exc)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user