I want to detect whether a file is locked, using python on Unix. It\'s OK to delete the file, assuming that it helps detects whether the file was locked.
The file could
I tried to lock a file in mac and delete the same file in another terminal. It allows the file to be deleted.
lock_file_path = "/tmp/lock.file" fd = open(lock_file_path,"w") fcntl.flock(fd.fileno(),LOCK_EX) while True: print("Locked")