Skip to content

Commit

Permalink
print: flush stdout to avoid buffering
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiodsf committed Jul 11, 2023
1 parent c6d4d8a commit 60060cf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions seiscat/print.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
GNU General Public License v3.0 or later
(https://www.gnu.org/licenses/gpl-3.0-standalone.html)
"""
import sys
from .db import read_fields_and_rows_from_db, get_catalog_stats
from .utils import err_exit

Expand Down Expand Up @@ -51,6 +52,7 @@ def _print_catalog_table(config, eventid=None, version=None):
val = 'None' if val is None else val
print(f'{val:{max_len[i]}}', end=' ')
print()
sys.stdout.flush()


def _print_catalog_csv(config, eventid=None, version=None):
Expand All @@ -72,6 +74,7 @@ def _print_catalog_csv(config, eventid=None, version=None):
for row in sorted(
rows, key=lambda r: (r[time_idx], r[ver_idx]), reverse=reverse):
print(','.join([str(val) for val in row]))
sys.stdout.flush()


def print_catalog(config):
Expand Down

0 comments on commit 60060cf

Please sign in to comment.