How can a file lock be checked in Python on Linux? How can a file lock be checked in Python on Linux? json json

How can a file lock be checked in Python on Linux?


You could use subprocess to invoke lsof from the command line like this

import subprocessfile_lock = str(subprocess.check_output("lsof | grep file_name", shell=True))