Skip to content

Commit

Permalink
flush upon init (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt authored May 5, 2017
1 parent f61891e commit 4f23b2d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

Version 2.11.1
================
- Flushes both `stdout` and `stderr` prior to `ProgressBar` initialization to avoid cluttering environments with previously cached print statements.

Version 2.11.0
================
- Use only 1 line to print the progress bar (instead of the previous too lines)
Expand Down
2 changes: 1 addition & 1 deletion pyprind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
from .generator_factory import prog_bar


__version__ = '2.11.0'
__version__ = '2.11.1'
3 changes: 3 additions & 0 deletions pyprind/prog_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def __init__(self, iterations, track_time, stream, title,
self.update_interval = update_interval
self._cached_output = ''

sys.stdout.flush()
sys.stderr.flush()

if monitor:
if not psutil_import:
raise ValueError('psutil package is required when using'
Expand Down
1 change: 0 additions & 1 deletion pyprind/progbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def _cache_progress_bar(self, progress):
' ' * int(remaining))

def _print(self, force_flush=False):
self._stream_flush()
progress = floor(self._calc_percent() / 100 * self.bar_width)
if self.update_interval:
do_update = time.time() - self.last_time >= self.update_interval
Expand Down

0 comments on commit 4f23b2d

Please sign in to comment.