ipe-tools
ipe-tools copied to clipboard
svgtoipe gives SyntaxWarning
On Ubuntu 24.04.2 LTS, Python 3.12.3, invoking svgtoipe gives
/usr/bin/svgtoipe:130: SyntaxWarning: invalid escape sequence '\.'
return re.findall("([A-Za-z]|-?[0-9]+\.?[0-9]*(?:e-?[0-9]*)?)", string)
/usr/bin/svgtoipe:181: SyntaxWarning: invalid escape sequence '\.'
d = re.findall("([A-Za-z]|-?(?:\.[0-9]+|[0-9]+\.?[0-9]*)(?:e-?[0-9]+)?)", d)
/usr/bin/svgtoipe:275: SyntaxWarning: invalid escape sequence '\('
d = re.findall("[a-zA-Z]+\([^)]*\)", txt)
/usr/bin/svgtoipe:701: SyntaxWarning: invalid escape sequence '\('
mat = re.match("url\(#([^)]+)\).*", fill)
/usr/bin/svgtoipe:936: SyntaxWarning: invalid escape sequence '\('
mat = re.match("url\(#([^)]+)\).*", node.getAttribute("clip-path"))
The bug can be fixed by making those strings raw. For example, line 130 becomes
return re.findall(r"([A-Za-z]|-?[0-9]+\.?[0-9]*(?:e-?[0-9]*)?)", string)
and so on.