Locking a file in Python

Alright, so I ended up going with the code I wrote here, on my website link is dead, view on archive.org (also available on GitHub). I can use it in the following fashion: from filelock import FileLock with FileLock(“myfile.txt”): # work with the file as it is now locked print(“Lock acquired.”)