Skip to main content

A platform independent file lock.

Project description

This package contains a single module, which implements a platform independent file locking mechanism for 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:

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


The full documentation is available on


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


This package is public domain.

Project details

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.7.tar.gz (5.0 kB view hashes)

Uploaded source

Supported by

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