Skip to content

Commit f59e4b1

Browse files
asomozasayakpaul
authored andcommitted
Fix object has no attribute 'flush' when using without a console (#8271)
fix
1 parent b52b0d2 commit f59e4b1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/diffusers/utils/logging.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ def _configure_library_root_logger() -> None:
8282
# This library has already configured the library root logger.
8383
return
8484
_default_handler = logging.StreamHandler() # Set sys.stderr as stream.
85-
_default_handler.flush = sys.stderr.flush
85+
86+
if sys.stderr: # only if sys.stderr exists, e.g. when not using pythonw in windows
87+
_default_handler.flush = sys.stderr.flush
8688

8789
# Apply our default configuration to the library root logger.
8890
library_root_logger = _get_library_root_logger()

0 commit comments

Comments
 (0)