python sys.stdout to file doesnt work code example Example: redirect python output to file $ python foo.py > file