What is the recommended way to replace a file atomically in Python?
i.e. if the Python script is interrupted, there is a power outage, etc. files are not likely to be in an inconsistent state (half written to disk).
The preferred solution is for Linux / UNIX platforms.
(I know that getting 100% atomic operations may depend on your file system, but at least it reduces the likelihood of low corruption)
Mikko ohtamaa
source share