Tee does not show output or write to file
Here's a simpler way of reproducing your issue:
$ cat foo.pyfrom time import sleepwhile True: sleep(2) print "hello"$ python foo.pyhellohello (...)$ python foo.py | tee log(no output)
This happens because python
buffers stdout when it's not a terminal. The easiest way to unbuffer it is to use python -u
:
$ python -u foo.py | tee loghellohello(...)
You can also set the shebang to #!/usr/bin/python -u
(this does not work with env
).