title: Tee does not show output or write to file
body: <p>I wrote a python script to monitor the statuses of some network resources, an infinite pinger if you will. It pings the same 3 nodes forever until it receives a keyboard interrupt. I tried using tee to redirect the output of the program to a file, but it does not work:</p>
  
  <pre><code>λ sudo ./pingster.py
  
  15:43:33        node1 SUCESS | node2 SUCESS | node3 SUCESS
  15:43:35        node1 SUCESS | node2 SUCESS | node3 SUCESS
  15:43:36        node1 SUCESS | node2 SUCESS | node3 SUCESS
  15:43:37        node1 SUCESS | node2 SUCESS | node3 SUCESS
  15:43:38        node1 SUCESS | node2 SUCESS | node3 SUCESS
  ^CTraceback (most recent call last):
    File "./pingster.py", line 42, in &lt;module&gt;
      main()
    File "./pingster.py", line 39, in main
      sleep(1)
  KeyboardInterrupt
  
  λ sudo ./pingster.py | tee ping.log
  # wait a few seconds
  ^CTraceback (most recent call last):
    File "./pingster.py", line 42, in &lt;module&gt;
      main()
    File "./pingster.py", line 39, in main
      sleep(1)
  KeyboardInterrupt
  
  λ file ping.log
  ping.log: empty 
  </code></pre>
  
  <p>I am using <a href="https://pypi.python.org/pypi/colorama" rel="noreferrer">colorama</a> for my output, I thought that perhaps could be causing the issue, but I tried printing something before I even imported colorama, and the file is still empty. What am I doing wrong here?</p>
  
  <p>Edit: Here is the python file I'm using</p>
  
  <pre><code>#!/home/nate/py-env/ping/bin/python
  
  from __future__ import print_function
  from datetime import datetime
  from collections import OrderedDict
  from time import sleep
  
  import ping
  import colorama
  
  
  def main():
      d = {
          'node1': '10.0.0.51',
          'node2': '10.0.0.50',
          'node3': '10.0.0.52',
      }
      addresses = OrderedDict(sorted(d.items(), key=lambda t: t[0]))
  
      colorama.init()
      while True:
          status = []
          time = datetime.now().time().strftime('%H:%M:%S')
          print(time, end='\t')
          for location, ip_address in addresses.items():
              loss, max_time, avg_time = ping.quiet_ping(ip_address, timeout=0.5)
              if loss &lt; 50:
                  status.append('{0} SUCESS'.format(location))
              else:
                  status.append(
                      '{}{} FAIL{}'.format(
                          colorama.Fore.RED,
                          location,
                          colorama.Fore.RESET,
                      )
                  )
          print(' | '.join(status))
          sleep(1)
  
  if __name__ == '__main__':
      main()
  </code></pre>