Skip to content

Commit 731c743

Browse files
Maxime-PerretMaximeMingxin Zhengmingxin-zheng
authored
Command format fix with backslashes on Windows System (#5280)
Fixes MONAI/apps/Auto3DSeg/bundle_gen.py ### Description Commands ran in subprocess currently cause issues with string formatting and backslashes not being escaped properly. Changing from Back Flash to Forward Slash solves the issue. ### 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: Maxime <[email protected]> Signed-off-by: Mingxin Zheng <[email protected]> Signed-off-by: Mingxin Zheng <[email protected]> Co-authored-by: Maxime <[email protected]> Co-authored-by: Mingxin Zheng <[email protected]> Co-authored-by: Mingxin Zheng <[email protected]> Co-authored-by: Mingxin Zheng <[email protected]
1 parent dae09ff commit 731c743

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

monai/apps/auto3dseg/bundle_gen.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import subprocess
1616
import sys
1717
from copy import deepcopy
18+
from pathlib import Path
1819
from tempfile import TemporaryDirectory
1920
from typing import Any, Dict, List, Mapping
2021

@@ -28,7 +29,7 @@
2829
from monai.utils import ensure_tuple
2930

3031
logger = get_logger(module_name=__name__)
31-
ALGO_HASH = os.environ.get("MONAI_ALGO_HASH", "004a63c")
32+
ALGO_HASH = os.environ.get("MONAI_ALGO_HASH", "d7bf36c")
3233

3334
__all__ = ["BundleAlgo", "BundleGen"]
3435

@@ -152,7 +153,8 @@ def _create_cmd(self, train_params=None):
152153
base_cmd += f"{train_py} run --config_file="
153154
else:
154155
base_cmd += "," # Python Fire does not accept space
155-
config_yaml = os.path.join(config_dir, file)
156+
# Python Fire may be confused by single-quoted WindowsPath
157+
config_yaml = Path(os.path.join(config_dir, file)).as_posix()
156158
base_cmd += f"'{config_yaml}'"
157159

158160
if "CUDA_VISIBLE_DEVICES" in params:

0 commit comments

Comments
 (0)