From 7393ebdcb4aa266e11818d82b554bb3b96ab8304 Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Tue, 4 Oct 2022 14:01:07 +0900 Subject: [PATCH] logger: init logging config before colorama --- dvc/logger.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dvc/logger.py b/dvc/logger.py index cf3cce2a1..b48457533 100644 --- a/dvc/logger.py +++ b/dvc/logger.py @@ -213,8 +213,6 @@ def set_loggers_level(level: int = logging.INFO) -> None: def setup(level: int = logging.INFO) -> None: - colorama.init() - if level >= logging.DEBUG: # Unclosed session errors for asyncio/aiohttp are only available # on the tracing mode for extensive debug purposes. They are really @@ -297,3 +295,8 @@ def setup(level: int = logging.INFO) -> None: "disable_existing_loggers": False, } ) + + # NOTE: colorama init needs to go after logging config to avoid potential + # conflicts with libs that modify logging (like tensorflow/abseil) + # https://github.com/iterative/dvc/issues/8387 + colorama.init()