You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A SyntaxError in scripts/segmentation_train.py while using Python3.12+ #228
Title: Invalid escape sequence \* in glob pattern on line 44 causes SyntaxError in Python 3.12+
Description:
On line 44, the code uses the following glob pattern:
elifany(Path(args.data_dir).glob("*\*.nii.gz")):
The string "*\*.nii.gz" contains an invalid escape sequence \*. In Python versions prior to 3.12, this would raise a DeprecationWarning, but starting in Python 3.12, it raises a SyntaxError because \* is not a valid escape sequence.
This breaks compatibility with modern Python versions.
Suggested Fix:
Use rglob for recursive matching (which is likely the intended behavior), or use forward slashes with proper glob syntax:
Using raw strings (e.g., r"*\*.nii.gz") is not advised here because backslashes are not standard in glob patterns—forward slashes work cross-platform with pathlib.
Please update the pattern to ensure compatibility and correctness.
Activity