Lockfile hanling

Ervin Hegedüs airween at gmail.com
Tue Mar 31 11:56:26 EDT 2015


Hi Skip,

On Tue, Mar 31, 2015 at 10:19:27AM -0500, Skip Montanaro wrote:
> > sorry - at the end of the function there is a close() method to a
> > file, after the thread passes the modifications:
> >
> >     try:
> >         os.remove(self.lockfile)
> >     except:
> >         syslog.syslog(syslog.LOG_DEBUG, "Sync error: " + str(sys.exc_info()[1]))
> 
> Hmmm... Still not seeing os.close(fl)...
> 
> > And I think, the "(deleted)" info near the filename in proc/PID/fd
> > means the lockfile had been deleted.
> 
> os.remove() will remove the lockfile name from the directory. It
> doesn't automatically close the file.

ah, well, many-many-many thanks - that was what I misses...

> >> You might consider the pylockfile module...
> 
> > sounds good, thanks - what's the minimal version of Python? I've
> > only 2.5 on that server...
> 
> When I was still maintaining it, it worked with 2.5, and I distributed
> a patch you could apply to get it to work with 2.4. I'm not sure if
> the current maintainers have changed that. You'd have to look. If
> worse comes to worst, I believe 0.9.1 (the last version I released)
> should still work with 2.5.

thanks for the info - now it works as very well.


a.
 



More information about the Python-list mailing list