Skip to content

Commit d97c00f

Browse files
committed
Changing the default tqdm output stream.
By default tqdm prints to sys.stderr. Change it to print to sys.stdout so that error messages originating in underlying libraries that cannot be silenced can be redirected to file and the progress bar is still visible.
1 parent b9c61b4 commit d97c00f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Python/scripts/characterize_data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ def inspect_files(
354354
maxinterval=60,
355355
miniters=tqdm_total // 10,
356356
disable=disable_tqdm,
357+
file=sys.stdout,
357358
):
358359
try:
359360
result = future.result()
@@ -578,6 +579,7 @@ def inspect_series(
578579
maxinterval=60,
579580
miniters=tqdm_total // 10,
580581
disable=disable_tqdm,
582+
file=sys.stdout,
581583
):
582584
try:
583585
result = future.result()
@@ -806,6 +808,10 @@ def characterize_data(argv=None):
806808
--metadata_keys "0008|0060" --metadata_keys_headings modality --ignore_problems --create_summary_image \
807809
--max_processes 15
808810
811+
Run a generic file analysis using a configuration file and redirect stderr to file.
812+
python characterize_data.py ../../Data/ Output/generic_image_data_report.csv per_file \
813+
--configuration_file ../../Data/characterize_data_user_defaults.json 2> errors.txt
814+
809815
Output:
810816
------
811817
The output from the script includes:

0 commit comments

Comments
 (0)