Describe the bug
This is not really a bug, just a slightly annoying warning:
SyntaxWarning: invalid escape sequence '\s'
It happens because of this line
|
\sa itk::simple::DiscreteGaussianImageFilter for the object oriented interface |
which was introduced four years ago in 3acb4c5.
I haven't seen that syntax in other Python files, but I have seen in some header files such as
|
* \sa itk::BSplineInterpolateImageFunction |
so I'm guessing it was an accident.
Python 3.12 upgraded the DeprecationWarning to a SyntaxWarning and that's why we see it now by default.
To Reproduce
Python 3.11
uv venv --python 3.11 sitk311
source sitk311/bin/activate
uv pip install SimpleITK
python -Wd -c "import SimpleITK" # note the flags to show deprecation warnings
Output:
<frozen importlib._bootstrap>:241: DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute
<frozen importlib._bootstrap>:241: DeprecationWarning: builtin type SwigPyObject has no __module__ attribute
<frozen importlib._bootstrap>:241: DeprecationWarning: builtin type swigvarlink has no __module__ attribute
/private/tmp/sitk311/lib/python3.11/site-packages/SimpleITK/extra.py:466: DeprecationWarning: invalid escape sequence '\s'
"""Blurs an image by separable convolution with discrete
Python 3.12
uv venv --python 3.12 sitk312
source sitk312/bin/activate
uv pip install SimpleITK
python -c "import SimpleITK"
Output:
/private/tmp/sitk312/lib/python3.12/site-packages/SimpleITK/extra.py:466: SyntaxWarning: invalid escape sequence '\s'
"""Blurs an image by separable convolution with discrete
Describe the bug
This is not really a bug, just a slightly annoying warning:
It happens because of this line
SimpleITK/Wrapping/Python/SimpleITK/extra.py
Line 476 in df1d844
which was introduced four years ago in 3acb4c5.
I haven't seen that syntax in other Python files, but I have seen in some header files such as
SimpleITK/Code/Common/include/sitkInterpolator.h
Line 41 in df1d844
so I'm guessing it was an accident.
Python 3.12 upgraded the
DeprecationWarningto aSyntaxWarningand that's why we see it now by default.To Reproduce
Python 3.11
Output:
Python 3.12
Output: