Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 621 Bytes

README.md

File metadata and controls

34 lines (27 loc) · 621 Bytes

python-simpleflock

Python module for very simple flock-based file locking.

Features

  • Uses Python's with syntax.
  • Doesn't complain if the lock file already exists but is stale.
  • Cleans up the lock file after itself.
  • Supports a timeout.

Example

import simpleflock

with simpleflock.SimpleFlock("/tmp/foolock"):
   # Do something.
   pass

# Raises an IOError in 3 seconds if unable to acquire the lock.
with simpleflock.SimpleFlock("/tmp/foolock", timeout = 3):
   # Do something.
   pass

BUGS

Unknown.

Contributing

Contributions welcome!