Skip to main content

A platform independent file lock.

Project description

This package contains a single module, which implements a platform independent file lock in Python.

The lock includes a lock counter and is thread safe. This means, when locking the same lock object twice, it will not block.

import filelock

lock = filelock.FileLock("my_lock_file")

with lock:
        pass

try:
        with lock.acquire(timeout = 10):
                pass
except filelock.Timeout:
        pass

What this filelock is not

A filelock provides a synchronisation mechanism between different instances of your application, similar to a thread lock. It can be used to signalize that files, directories or other resources are currently used or manipulated (Think of a sync.lock file). Only the existence of the lockfile is watched for this purpose. The file itself can not be written and is always empty.

Perhaps you are looking for something like

Documentation

The full documentation is available on readthedocs.org.

Contributions

Contributions are always welcome. Never hesitate to open a new issue.

License

This package is public domain.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

filelock-2.0.10.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file filelock-2.0.10.tar.gz.

File metadata

  • Download URL: filelock-2.0.10.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for filelock-2.0.10.tar.gz
Algorithm Hash digest
SHA256 c73bf706d8a0c5722de0b745495fed9cda0e46c0eabb44eb18ee3f00520fa85f
MD5 1712a43982b6a7313cedd248bfb4606b
BLAKE2b-256 c066044ca468c7dd541e9636a5340d77cb418082c4b0dffcf1dabd28efc7a7e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page