I'm writing a python script that copies a file using shutil.copyfile() on Linux. During the copying, other processes may be trying to read the file. Is the following sufficient to ensure that an external process doesn't get a corrupted view of the file?
os.unlink(dest)
shutil.copyfile(src, dest)
That is, is shutil.copyfile() atomic such that other processes cannot read the destination file until after the copy operation is complete?