def unlock(self): if self.lockfp is None: return fd = self.lockfp.fileno() fcntl.lockf(fd, fcntl.LOCK_UN) self.lockfp.close() self.lockfp = None