"invalid escape sequence '\d'" in Komodo Edit

I’m not sure how many of you people are using Komodo Edit (an open source version of Komodo IDE), but I have to try.

I’ve got a fresh install of the program and when I open a python file it shows me an “Syntax Warning: invalid escape sequence ‘\d’” at a random line. It is strange because the file has no single slash character anywhere. Has anyone faced this issue?

If you copy the one random line and make a minimal python file from it does that also get the error?
If so share the small example here as pre-formatted text for us to review.

#!/usr/bin/python

from pathlib import Path
from xml.etree.ElementTree import TreeBuilder, indent, tostring


XML_HEADER = '<?xml version="1.0" encoding="UTF-8"?>'



def write_xml(filename: Path, xml, pretty: bool = False) -> None:
	builder = TreeBuilder(insert_comments=True, insert_pis=True)
	if pretty:
		indent(result, space="\t")
	filename.write_text(XML_HEADER + "\n" + tostring(result, encoding="unicode"))

Now it shows the warning in the last line

I just pasted that text in a .py file and it ran just fine without any syntax errors on Windows. Is Komodo Edit saving the file in a strange encoding, which when Python reads as UTF-8 (or whatever is setup as its default), manages to mis-decode some characters as \d? Or vice-versa (is Komodo decoding UTF-8 as something else, and creating a spurious \d)?

Also, I can’t think why this would create a Syntax Error, but where’s result defined?

Maybe report it as a bug: GitHub - ActiveState/OpenKomodoIDE: Open Komodo IDE is a fast and free multi-language code editor. Written in JS, Python, C++ and based on the Mozilla platform., just to document it for others.

I noticed this:

Prerequisites

And in Python 2.7 "\d" is not a Syntax Error, so are you using Komodo with an incompatible Python 3 version, that has stricter syntax?

But note that there’s been no activity on that repository for years…

@FelixLeg, what version of Python are you using, and how are you running Komodo Edit?

I ask because the repository linked above states that the IDE uses Python 2.7. The SyntaxWarning you’re reporting is much newer than that–it started being a warning in Python 3.12.

If you’re running Komodo Edit by invoking Python directly and using 3.12 to do so, it is likely that the error is in the IDE itself, not in your code. Given that a whole lot of other stuff has changed since 2.7, I doubt it will work at all.

Nah, I removed the app. It was more trouble than worth :frowning:

You did right. There are "\d"s in their Python code