Skip to content

Simple flock-based file locking using Python's `with` syntax

License

Notifications You must be signed in to change notification settings

synatree/python-simpleflock

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

Simple flock-based file locking using Python's `with` syntax

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%