From 38527116969c31712580cc1ce26d4fe0c292e1d2 Mon Sep 17 00:00:00 2001 From: rajith Date: Tue, 12 Nov 2024 14:05:54 +0530 Subject: [PATCH] handle log_file not set --- openfl/interface/cli.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openfl/interface/cli.py b/openfl/interface/cli.py index 9bed2d6c91..9937ddea01 100755 --- a/openfl/interface/cli.py +++ b/openfl/interface/cli.py @@ -181,7 +181,12 @@ def cli(context, log_level, no_warnings): # Setup logging immediately to suppress unnecessary warnings on import # This will be overridden later with user selected debugging level disable_warnings() - log_file = pathlib.Path(os.getenv("LOG_FILE")).expanduser().resolve() + log_file = os.getenv("LOG_FILE") + if log_file is None: + raise ValueError("LOG_FILE environment variable is not set") + + # Normalize the path + log_file = pathlib.Path(log_file).expanduser().resolve() setup_logging(log_level, log_file) sys.stdout.reconfigure(encoding="utf-8")