This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author takluyver
Recipients Arfrever, barry, eric.araujo, eric.smith, exarkun, giampaolo.rodola, loewis, martin.panter, meatballhat, milko.krachounov, ncoghlan, neologix, olemis, pitrou, socketpair, takluyver, tarek, vstinner
Date 2016-01-20.13:16:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1453295803.4.0.5126054749.issue8604@psf.upfronthosting.co.za>
In-reply-to
Content
For reference, we added our own atomic_writing() context manager in Jupyter/IPython, after someone lost work when save failed on a full disk. We initially went for the same approach - write to a temporary file, fsync, rename over the original file - but it caused issues with network filesystems and folders synced by Dropbox or similar services.

As a result we switched to an approach that copies the old file to a temporary name, writes the new data directly to the old name, then removes the temporary copy on success, or renames it back to the old name on failure. This is certainly less rigorous, but it means that we're not replacing the file on every save, and it's less of a problem if copying file attributes with copystat() fails.

I'm sure there are use cases for atomic writing where these problems won't come up, but I hope this is a useful data point, at least for documenting any atomic writing solution.
History
Date User Action Args
2016-01-20 13:16:43takluyversetrecipients: + takluyver, loewis, barry, exarkun, ncoghlan, pitrou, vstinner, eric.smith, giampaolo.rodola, tarek, eric.araujo, Arfrever, olemis, meatballhat, milko.krachounov, neologix, socketpair, martin.panter
2016-01-20 13:16:43takluyversetmessageid: <1453295803.4.0.5126054749.issue8604@psf.upfronthosting.co.za>
2016-01-20 13:16:43takluyverlinkissue8604 messages
2016-01-20 13:16:43takluyvercreate