Use -u option to python for turning off buffering