title: In what way is fcntl.lockf() locking a file?
body: <p>I'm currently attempting to lock a file via python so other processes cannot even read it.</p>
  
  <p>So far i was testing behavior of fcntl.lockf() via python interpreter:</p>
  
  <pre><code>&gt;&gt;&gt; file = open("/path/to/file", "w")
  &gt;&gt;&gt; fcntl.lockf(file.fileno(), fcntl.LOCK_EX | fcntl_LOCK_READ)
  </code></pre>
  
  <p>I've tried this and few other variations of fcntl.lockf but still i was able to open the file second time and obtain his fd.
  I was able to read it and also write to it.</p>
  
  <p>Am I missing something or this should not lock the file for other procesess at all? Is there any other way to do it?</p>