Skip to main content

Pidfile featuring stale detection and file-locking, can also be used as context-manager

Project description

https://travis-ci.org/trbs/pid.svg?branch=master https://coveralls.io/repos/trbs/pid/badge.png

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:

with PidFile():
  do_something()

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 use just PidFileError since it will capture all possible PidFile exceptions.

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

pid-1.0.3.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

pid-1.0.3-py2.py3-none-any.whl (4.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pid-1.0.3.tar.gz.

File metadata

  • Download URL: pid-1.0.3.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pid-1.0.3.tar.gz
Algorithm Hash digest
SHA256 591ec97554c1e7b8ab53b5a3b6ddea2c01bd20673d6c3d1327baaaebc52f2afc
MD5 bcc545f0c63429cbe3f86a3d4d411d4c
BLAKE2b-256 064889deeddd1c5c0a6f2d4211df2ec6987611fd20ede0ec904dcab479baee18

See more details on using hashes here.

File details

Details for the file pid-1.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pid-1.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5d3a2ec786986cac2096110b374b5cd9fe022d02d9d7cf5064dc52ed9eebac4a
MD5 bfe614de1488031b59463a5f26e15ba9
BLAKE2b-256 8f8c0233bfa09ba323bdafbc304939e31d41438dee557603eb6abd5c8967013c

See more details on using hashes here.

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