-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Command format fix with backslashes on Windows System #5280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Maxime <[email protected]>
thanks, could you please make a minimal example to describe the bug following the issue template? https://github.com/Project-MONAI/MONAI/issues/new?assignees=&labels=&template=bug_report.md&title= |
Hello @wyli and thank you for your answer. I apologize for not properly introducing my pull request. This comes from the discussion I opened on one of the tutorial. I was asked to submit a pull request to fix the first bug I mentioned in that discussion. It comes from running the auto3dseg_autorunner_ref_api.ipynb notebook, I believe the issue being because of Windows, and the pull request I submitted fixes the notebook for me at least. Let me know if there is something else I should provide. |
thanks for reporting, I think the issue is partly from the notebook https://github.com/Project-MONAI/tutorials/blob/main/auto3dseg/notebooks/auto3dseg_autorunner_ref_api.ipynb root = "./" which is an os-dependent path... perhaps we should use |
@wyli @Maxime-Perret I will have access to a GPU windows system later today, and plan to update the path in the Auto3Dseg tutorial |
@Maxime-Perret After some debugging, I would suggest replacing this line config_yaml = os.path.join(config_dir, file) with config_yaml = Path(os.path.join(config_dir, file)).as_posix() The path problem occurred when we add single quotes to the base_cmd += f"'{config_yaml}'" when Changing the |
Signed-off-by: Mingxin Zheng <[email protected]>
@mingxin-zheng do you think double quotes would address this already and to escape some other characters such as white space in the filepath. https://stackoverflow.com/questions/36379789/python-subprocess-unable-to-escape-quotes |
Hi @wyli , do you mean replacing single quotes with double? This is more of an issue from PythonFire rather than the subprocess call. Here is an example how to pass a str to Python Fire: |
I see, strange that PythonFire doesn't have any discussions about this... |
It is possible that file paths are not frequently used as inputs in Python Fire. For a list of 2 file strings, one needs to put up something like: I think the latter is better as I haven't experienced any errors using |
Signed-off-by: Mingxin Zheng <[email protected]>
I have tested some of the Auto3DSeg codes on a Windows/GPU platform and the file path issues are gone. It looks good to me now. |
/build |
…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]
Hello @mingxin-zheng, |
…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] Signed-off-by: Behrooz <[email protected]>
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] Signed-off-by: KumoLiu <[email protected]>
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
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests --disttests
.make html
command in thedocs/
folder.