title: Python print to stderr in generator
body: <p>Building a python fuse fs, in my readdir generator the first line of code is a print statement. This never appeared on my console. I modified it to a print to stderr as i thought it was a buffering issue. Still no output. </p>
  
  <p>I added a manual flush to the next line - still nothing.</p>
  
  <p>I added a time.sleep(3) to the next line, the prog does indeed sleep.</p>
  
  <pre><code>def readdir(self, path, offset):
      print &gt;&gt; sys.stderr, 'Text'
      sys.stderr.flush()
      time.sleep(3)
  </code></pre>
  
  <p>I then go on to populate the directory with other code (yield fuse.Direntry)
  I do get output and can do an ls in the terminal to see the contents of my mounted fuse directory, but I want to know why the print command doesn't work in this one generator.</p>
  
  <p>Update</p>
  
  <p>For those that are struggling :</p>
  
  <pre><code>def readdir(self, path, offset):
      print &gt;&gt; sys.stderr, 'Text'
      sys.stderr.flush()
      for o in os.listdir( "." + path ):
          yield fuse.Direntry(o)
  </code></pre>
  
  <p>Is the code. It generates a file list and I can move around it. That is fine.
  The problem is I never see 'Text' appear, not in STDOUT, STDERR, anywhere.</p>
  
  <p>I was simply asking why this happens only in this generator. I can put print elsewhere in the fuse code and get output very well.</p>