> On 7 Jul 2024, at 22:13, Chris Green via Python-list <python-list@python.org> > wrote: > > a simple file lock can then > be used to prevent simultaneous access (well, simultaneous access when > the writing process is writing). There is a simple pattern to make this robust. Write new values to a tmp file. Close the tmp file. Then use os.rename(tmpfile, productionfile). This is guaranteed that any process that reads the file will only see all the old file contents or all the new file contents, never a mix of both. Barry -- https://mail.python.org/mailman/listinfo/python-list
- Best (simplest) way to share data betwe... Chris Green via Python-list
- Re: Best (simplest) way to share d... Piergiorgio Sartor via Python-list
- Re: Best (simplest) way to sha... Chris Green via Python-list
- Re: Best (simplest) way to share d... Gordinator via Python-list
- Re: Best (simplest) way to share d... Barry via Python-list
- Re: Best (simplest) way to sha... MRAB via Python-list
- Re: Best (simplest) way to... Barry Scott via Python-list
- Re: Best (simplest) way to share d... Left Right via Python-list
- Re: Best (simplest) way to share d... Chris Green via Python-list
- Re: Best (simplest) way to sha... Chris Green via Python-list