3 ms·
I had a python script that was roughly: read file, unpickle, do stuff in memory, pickle, write. A bug in "do stuff in memory" could easily muck things up and
by tim333 8y ago
I had a python script that was roughly:
read file, unpickle, do stuff in memory, pickle, write.
A bug in "do stuff in memory" could easily muck things up and I didn't get round to renaming the file for every edit. Yeah you could do some auto rename thing but it might be simpler to just use sqlite.
- int_19h 8y ago> I didn't get round to renaming the file for every edit. That was your problem then, no? If you don't do that from the get go, you're essentially saying that you don't care about atomicity, consistency and durability. > Yeah you could do some auto rename thing but it might be simpler to just use sqlite. You mean atomic rename? The simplest way is to just use a library that does it for you. One does exist for Python. It takes 2 lines of code to safely dump your JSON data with it.