fix: write scraped files whole or not at all

This commit is contained in:
Abdessamad Derraz committed 2026-10-10 04:45:10 +02:00
1 parent 170b7d93ae
commit a00f57ad37
7 files changed
+51 -19

No files matched your search

+1 -1
View File
@@ -60,7 +60,7 @@ def write_text_atomic(path: str, content: str) -> None:
dir=directory, prefix=f".{os.path.basename(path)}.", suffix=".tmp"
)
try:
with os.fdopen(handle, "w") as f:
with os.fdopen(handle, "w", encoding="utf-8") as f:
f.write(content)
os.replace(scratch, path)
except BaseException: