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.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: iolocker-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 189f99e1074276fe496a585cb9febe04751b975cf680fc04f06b8f6cb2772b6d
MD5 b51813c91e031cf8e03957ef5031f417
BLAKE2b-256 3448e606d333844e29f9229b41a8aedcc5a1d46c2451c1c948633752246b9a23

See more details on using hashes here.

File details

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

File metadata

  • Download URL: iolocker-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b929a7beb2e35577fc85c7397e54d684233709b542be81012eae86cedc56a865
MD5 69ed67aff7073381825a4cd74e4c6aac
BLAKE2b-256 7eb0353abe241f5720b3dd92ce2f590f82fb65995187a7050faa7b923fc6845e

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