Skip to main content

Simple file locker.

Project description

iolocker

Simple file locker.


Installation:

python -m pip install [--upgrade] iolocker

Usage:

# -*- coding: UTF-8 -*-

from iolocker import FileLocker, LOCK

if __name__ == '__main__':

    file_handle = open("test_file.txt", "a", encoding="UTF-8")
    lock = FileLocker()

    fh = lock.acquire(file_handle, flags=LOCK.EX)
    fh.write("Testing file lockers...\n")
    lock.release(handle=fh)

or as context-manager:

# -*- coding: UTF-8 -*-

from iolocker import FileLocker, LOCK

if __name__ == '__main__':

    with open("test_file.txt", "a", encoding="UTF-8") as fh:
        with FileLocker(fh, flags=LOCK.EX) as locked:
            locked.write("Testing file lockers...\n")

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

iolocker-1.0.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

iolocker-1.0.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file iolocker-1.0.1.tar.gz.

File metadata

  • Download URL: iolocker-1.0.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for iolocker-1.0.1.tar.gz
Algorithm Hash digest
SHA256 03839bea975494c81ddfd39c7347d2533d8e0d7bc1820b3beb7219ecb2deb057
MD5 38bfef75dc63753a46a2e7f4672a280e
BLAKE2b-256 9673536640b1098f089871e42a0df6b9c59d4ea4e54fbd2324bddd62ac369b93

See more details on using hashes here.

File details

Details for the file iolocker-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: iolocker-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for iolocker-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe0c010fa238074d83b2bb7e3497c6eb025db5a41a15d098b6ac5182b6e352b6
MD5 9c6acb7762192a45dad433ba41165bbd
BLAKE2b-256 3bbe6e8f3d3a3155e548b6c5581c54ff26604bc538dc410312aa2a96dbfef309

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