Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python lock using a file

from filelock import FileLock

with FileLock("myfile.txt.lock"):
    print("Lock acquired.")
    with open("myfile.txt"):
        # work with the file as it is now locked
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #lock #file
ADD COMMENT
Topic
Name
9+6 =