title: Blocking file read in python
body: <p>I need to read binary data structures as they are flushed to a file in Windows. I don't have control over the program that writes the data, it's a black-box LP model that always writes to a few hard-coded filenames, but I do know it flushes it's output periodically. I would like to read this data as its written, from several files at once. I don't have a problem forking a thread for each file, but it would be really convenient if I could use read(n) and have it block until it reads an <em>entire</em> n bytes, or readinto(d) and have it block until the buffer is full. Is this possible to do in Python on Windows?</p>
  
  <p>I'm having a tough time searching for this because all anyone ever talks about is non-blocking and how to do it. But with this solution I intend to let the children block and report data back via a queue to a parent that doesn't block.</p>
  
  <p>If there isn't a way to get the blocking reads, is there a way to avoid busy waiting or sleep()ing?</p>