Got rid of #!/usr/bin/env python -u

and using PYTHONUNBUFFERED=true instead.