compute tempfile path only once
This commit is contained in:
@@ -430,10 +430,11 @@ class Extractor():
|
|||||||
if not path:
|
if not path:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
path_tmp = path + ".tmp"
|
||||||
try:
|
try:
|
||||||
with open(path + ".tmp", "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)
|
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