Skip to content

Commit 11ed2ff

Browse files
authored
Fix check for interactive stdout in _style function (#47283)
1 parent 529858a commit 11ed2ff

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/transformers/utils/loading_report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _make_table(rows, headers):
120120

121121
def _style(s, color):
122122
"""Return color/style-formatted input `s` if `sys.stdout` is interactive, e.g. connected to a terminal."""
123-
if sys.stdout.isatty():
123+
if sys.stdout is not None and sys.stdout.isatty():
124124
return f"{PALETTE[color]}{s}{PALETTE['reset']}"
125125
else:
126126
return s

0 commit comments

Comments
 (0)