FileLock(lock_file_path, timeout=- 1, delay=0.05)¶
A file locking mechanism that has context-manager support so you can use it in a with statement. This should be relatively cross compatible as it doesn't rely on msvcrt or fcntl for the locking.
Acquire the lock, if possible. If the lock is in use, it check again every
waitseconds. It does this until it either gets the lock or exceeds
timeoutnumber of seconds, in which case it throws an exception.
Get rid of the lock by deleting the lockfile. When working in a
withstatement, this gets automatically called at the end.