glTF-Blender-IO
glTF-Blender-IO copied to clipboard
fix invalid escape sequence
C:\Program Files (x86)\Steam\steamapps\common\Blender\4.1\scripts\addons\io_scene_gltf2\io\exp\gltf2_io_image_data.py:25: DeprecationWarning: invalid escape sequence '\.'
regex_dot = re.compile("\.")
C:\Program Files (x86)\Steam\steamapps\common\Blender\4.1\scripts\addons\io_scene_gltf2\io\exp\gltf2_io_image_data.py:27: DeprecationWarning: invalid escape sequence '\]'
new_name = "".join([char for char in adjusted_name if char not in "!#$&'()*+,/:;<>?@[\]^`{|}~"])
Using warnings.filterwarnings('error')
Blender 4.2.0 Alpha (hash c61ecf1f4094 built 2024-03-22 01:51:54)
Traceback (most recent call last):
File "<string>", line 23, in <module>
File "<string>", line 14, in func
File "C:\blender\blender-4.2.0-alpha+main.c61ecf1f4094-windows.amd64-release\4.2\scripts\addons\io_scene_gltf2\io\exp\gltf2_io_image_data.py", line 25
regex_dot = re.compile("\.")
^^^^
SyntaxError: invalid escape sequence '\.'
Hello, Any context of this PR? Is that an error you encounter? Do you have an example file that shows this error?
It is a "compile time" error so __pycache__
should be absent and warnings.filterwarnings('error')
set.
A backslash-character pair that is not a valid escape sequence now generates a SyntaxWarning, instead of DeprecationWarning. For example, re.compile("\d+.\d+") now emits a SyntaxWarning ("\d" is an invalid escape sequence, use raw strings for regular expression: re.compile(r"\d+.\d+")). In a future Python version, SyntaxError will eventually be raised, instead of SyntaxWarning. (Contributed by Victor Stinner in gh-98401.)
C:\Users\user>python
Python 3.9.12 (tags/v3.9.12:b28265d, Mar 23 2022, 23:52:46) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a = '\.'
>>> a
'\\.'
>>> import warnings
>>> warnings.filterwarnings('error')
>>> b = '\.'
File "<stdin>", line 1
b = '\.'
^
SyntaxError: invalid escape sequence \.
Merged. Thanks!