Pidfile featuring stale detection and file-locking, can also be used as context-manager or decorator
Project description
PidFile class featuring:
stale detection
pidfile locking (fcntl)
chmod (default is 0o644)
chown
custom exceptions
Context Manager
PidFile can be used as a context manager:
from pid import PidFile with PidFile(): do_something()
Decorator
PidFile can also be used a a decorator:
from pid.decorator import pidfile @pidfile() def main(): pass if __name__ == "__main__": main()
Exception Order
In default mode PidFile will try to acquire a file lock before anything else. This means that normally you get a PidFileAlreadyLockedError instead of the PidFileAlreadyRunningError when running a program twice.
If you just want to know if a program is already running its easiest to catch just PidFileError since it will capture all possible PidFile exceptions.
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
Built Distribution
File details
Details for the file pid-1.0.9.tar.gz
.
File metadata
- Download URL: pid-1.0.9.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c68498ba1cd21cc2ab84e38070e7f2a19e22fc9bcf44ba3031b8c19e7e9b9b5 |
|
MD5 | f706df9e4c2072ead05df3ebe5ed5395 |
|
BLAKE2b-256 | 9eda6f780e844dc855db5b828d9c45114bfa1ec5572e5ca5e0e68c3ebbdb76bc |
File details
Details for the file pid-1.0.9-py2.py3-none-any.whl
.
File metadata
- Download URL: pid-1.0.9-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4a69f3901c3cbdf35af3e41dd43a29b64d2859b4ffc15a0c14b7a706613f016 |
|
MD5 | e5b901f86381384ecc261e6cb5f06e7e |
|
BLAKE2b-256 | db14cf330f21b22656ae02bc52a0e01f15fe109704bc1b9e5f9bfbe15c7d8a8f |