fcntl

How to use "fcntl.lockf" in Python?

How to use "fcntl.lockf" in Python? Question: I found this question but I do not know how to use the suggestion. I have tried with open(fullname) as filein: fcntl.lockf(filein, fcntl.LOCK_EX | fcntl.LOCK_NB) and with open(fullname) as filein: fcntl.lockf(filein.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB) but in both cases I get an error OSError: [Errno 9] Bad file descriptor …

Total answers: 1

How to get hard disk serial number using Python

How to get hard disk serial number using Python Question: How can I get the serial number of a hard disk drive using Python on Linux? I would like to use a Python module to do that instead of running an external program such as hdparm. Perhaps using the fcntl module? Asked By: Forge || …

Total answers: 5