python redirect stdout to file