diff --git a/nvflare/app_common/executors/task_script_runner.py b/nvflare/app_common/executors/task_script_runner.py index 1c26a56675..8a5f937cf6 100644 --- a/nvflare/app_common/executors/task_script_runner.py +++ b/nvflare/app_common/executors/task_script_runner.py @@ -60,7 +60,8 @@ def run(self): xs = [p for p in sys.path if self.script_full_path.startswith(p)] import_base_path = max(xs, key=len) raise ImportError( - f"{ie.msg}, the relative import is not support. python import is based off the sys.path: {import_base_path}") + f"{ie.msg}, the relative import is not support. python import is based off the sys.path: {import_base_path}" + ) else: raise ie except Exception as e: diff --git a/tests/unit_test/app_common/executors/task_script_runner_test.py b/tests/unit_test/app_common/executors/task_script_runner_test.py index 72c3a3447e..4e19c81960 100644 --- a/tests/unit_test/app_common/executors/task_script_runner_test.py +++ b/tests/unit_test/app_common/executors/task_script_runner_test.py @@ -191,7 +191,7 @@ def test_run_relative_import_scripts(self): ) self.assertTrue(wrapper.script_full_path.endswith(script_path)) msg = "attempted relative import with no known parent package, the relative import is not support. python import is based off the sys.path: /home/chester/projects/NVFlare/tests/unit_test/app_common/executors/site-1/custom" - with pytest.raises(ImportError,match=msg): + with pytest.raises(ImportError, match=msg): # check the ImportError wrapper.run() finally: