title: Python read file in to buffer and process results in chunks when buffer is full
body: <p>I need to read binary file in specific chunks, but in some cases that file gets new data while being read. 
  So I am thinking that solution is to read file in to buffer until buffer gets full and then process the data in the buffer and begin filling it with new data.
  In this case I am reading 160 bytes.</p>
  
  <p>My test code looks like this</p>
  
  <pre><code>with open('test.raw',"rb") as f:
      byte = f.read(160)
      while byte != b"":
          byte = f.read(160) 
  </code></pre>