Skip to main content

A simple lock file class based on file locking.

Project description

flockfile

Just a simple python lock file class using file locks.

Installation

pip install flockfile

Usage

from flockfile import FlockFile, FileNotLocked

# init the class using a file name
# optionally, the directory can be set to something other than /tmp
lock = FlockFile("myscriptname", lock_dir="/tmp")


# lock the file
lock.lock()
# if this is unsuccessful, exception FileNotLocked will be raised.

# the following class method can be used to check lock status
assert lock.check_lock()

# unlock and delete file
lock.unlock()

Questions or Issues?

Please report as a Gitlab issue: https://gitlab.com/rveach/flockfile/issues

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for flockfile, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size flockfile-0.1.2.tar.gz (2.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page