title: Two processes reading/writing to the same file Python
body: <p>I have one process who's reading from a file (using <code>file.read()</code>) and one process who's writing to the same file (<code>file.write()</code>). The problem is it doesn't work - I get no errors but they can't operate at the same time. I've tried making the read and write operations none-blocking and then flushing the stream, as follows:</p>
  
  <pre><code>fcntl.fcntl(file, fcntl.F_SETFL, os.O_NONBLOCK)
  file.write(msg)
  file.flush()
  </code></pre>
  
  <p>Am I completely misunderstanding it? How should one accomplish writing and reading to one file from different processes?</p>