title: Converting file descriptor (pipe) to file object in python
body: <p>I'd like to use anonymous pipes to communicate pickled objects between two processes in linux. I don't want to use the <code>subprocess</code> module and instead manually create the necessary pipes and then call <code>pickle.dump</code> and <code>pickle.load</code>. The last two functions, however, require a file object. So, while testing things around, I was faced with the following problem. The following code works fine:</p>
  
  <pre><code>import os
  r, w = os.pipe()
  os.write(w, b"test")
  os.read(r, 1024)
  </code></pre>
  
  <p>but this code stalls at the read operation</p>
  
  <pre><code>import os
  r, w = os.pipe()
  fr = os.fdopen(r, "rb")
  fw = os.fdopen(w, "wb")
  fw.write(b"test")
  fr.read()
  </code></pre>
  
  <p>Additionally, <code>select.select([r],[],[],0)</code> shows the pipe is empty. My question: what is going on during file object creation and why doesn't it work for pipes? Is there a way to get a file object this way at all?</p>