title: Python Popen stderr catch output
body: <p>I am running a command via Popen and catching the stderr and using that to update a display elsewhere, this is working correctly, updating every time stderr outputs something, but I am also trying to save the output to a log file in realtime. While this does write the output to a file, it doesn't seem to update this file very often. Is there a way I get get the output writing to the file every time there is something to write?
  Here is the code:</p>
  
  <pre><code>self.process1 = Popen(command, startupinfo=startupinfo, stderr=subprocess.PIPE)
  logFile = open(logFilePath, "a")
  while True:
      line222 = self.process1.stderr.readline().decode('utf-8')
      logFile.write(line222)
  </code></pre>