How to safely maintain a status file

Chris Angelico rosuav at gmail.com
Fri Jul 13 02:02:13 EDT 2012


On Fri, Jul 13, 2012 at 2:26 PM,  <rantingrickjohnson at gmail.com> wrote:
> On Thursday, July 12, 2012 10:13:47 PM UTC-5, Steven D'Aprano wrote:
>> Rick has obviously never tried to open a file for reading when somebody
>> else has it opened, also for reading, and discovered that despite Windows
>> being allegedly a multi-user operating system, you can't actually have
>> multiple users read the same files at the same time.
>
> You misread my response. My comment was direct result of Christian stating:
>
> (paraphrase) "On some systems you are not permitted to delete a file whilst the file is open "
>
> ...which seems to be consistent to me. Why would *anybody* want to delete a file whilst the file is open?

POSIX doesn't let you delete files. It lets you dispose of filenames.
Python does the same with its 'del'. The object (file) exists until
the system decides otherwise.

Here's a simpler example: Hardlinks. Suppose you have two names
pointing to the same file; are you allowed to unlink one of them while
you have the "other" open?

ChrisA



More information about the Python-list mailing list