[Python] RE: How to safely maintain a status file
Chris Angelico
rosuav at gmail.com
Fri Jul 13 14:19:24 EDT 2012
More information about the Python-list mailing list
Fri Jul 13 14:19:24 EDT 2012
- Previous message (by thread): [Python] RE: How to safely maintain a status file
- Next message (by thread): How to safely maintain a status file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Jul 14, 2012 at 3:59 AM, Prasad, Ramit <ramit.prasad at jpmorgan.com> wrote: > I lean slightly towards the POSIX handling with the addition that > any additional write should throw an error. You are now saving to > a file that will not exist the moment you close it and that is probably > not expected. There are several different possible "right behaviors" here, but they depend more on the application than anything else. With a log file, for instance, the act of deleting it is more a matter of truncating it (dispose of the old history), so the right thing to do is to start a fresh file. Solution: Close the file and re-open it periodically. But I don't know of an efficient way to do that with Windows semantics. Renaming/moving an open file in order to perform log rotation isn't all that easy. ChrisA
- Previous message (by thread): [Python] RE: How to safely maintain a status file
- Next message (by thread): How to safely maintain a status file
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list