diff --git a/src/diffusers/utils/logging.py b/src/diffusers/utils/logging.py index 2e80d30f13..6f93450c41 100644 --- a/src/diffusers/utils/logging.py +++ b/src/diffusers/utils/logging.py @@ -82,7 +82,9 @@ def _configure_library_root_logger() -> None: # This library has already configured the library root logger. return _default_handler = logging.StreamHandler() # Set sys.stderr as stream. - _default_handler.flush = sys.stderr.flush + + if sys.stderr: # only if sys.stderr exists, e.g. when not using pythonw in windows + _default_handler.flush = sys.stderr.flush # Apply our default configuration to the library root logger. library_root_logger = _get_library_root_logger()