From f62a00802c6e28527427cf0ae66ddd3538b3d8ea Mon Sep 17 00:00:00 2001 From: "H@di" Date: Tue, 31 Aug 2021 02:24:28 +0430 Subject: [PATCH] Log progress in stderr instead of stdout --- geneticalgorithm/geneticalgorithm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/geneticalgorithm/geneticalgorithm.py b/geneticalgorithm/geneticalgorithm.py index 3dc8341..5f1d5d3 100644 --- a/geneticalgorithm/geneticalgorithm.py +++ b/geneticalgorithm/geneticalgorithm.py @@ -554,8 +554,8 @@ def progress(self, count, total, status=''): percents = round(100.0 * count / float(total), 1) bar = '|' * filled_len + '_' * (bar_len - filled_len) - sys.stdout.write('\r%s %s%s %s' % (bar, percents, '%', status)) - sys.stdout.flush() + sys.stderr.write('\r%s %s%s %s' % (bar, percents, '%', status)) + sys.stderr.flush() ############################################################################### ###############################################################################