Don't call fflush() on a read-only file pointer; it is an error on BSD systems and causes the import of matplotlib.pyplot to fail.