How to prevent BrokenPipeError when doing a flush in Python? How to prevent BrokenPipeError when doing a flush in Python? unix unix