So I have a python script which I'm redirecting stdout AND stderr to a file. I need to flush this file periodically. What is the best way to achieve this
sys.stdout = sys.stderr = open('location/log.txt', 'w')
Do we have to do it in two separate steps?
sys.stdout.flush()
sys.stderr.flush()
I'm doing this as i'm constantly reading from this file to check for updates.