Skip to content

Commit 252b797

Browse files
Nic-Mawyli
andauthored
5233 Add file check for the logging config (#5235)
Fixes #5233 . ### Description This PR added file existing check for the logging config, requested by @holgerroth . ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: Nic Ma <nma@nvidia.com> Co-authored-by: Wenqi Li <831580+wyli@users.noreply.github.com>
1 parent 663cfd0 commit 252b797

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

monai/bundle/scripts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,8 @@ def run(
494494
_args, "config_file", meta_file=None, runner_id="", logging_file=None
495495
)
496496
if logging_file_ is not None:
497+
if not os.path.exists(logging_file_):
498+
raise FileNotFoundError(f"can't find the logging config file: {logging_file_}.")
497499
logger.info(f"set logging properties based on config: {logging_file_}.")
498500
fileConfig(logging_file_, disable_existing_loggers=False)
499501

0 commit comments

Comments
 (0)