GChristensen / enso-portable

Portable Enso Launcher community edition
Other
164 stars 46 forks source link

SyntaxWarning in debug console #31

Closed gilch closed 1 month ago

gilch commented 1 month ago

I only noticed this after upgrading to version 1.1 when using debug.bat for investigating an unrelated issue.

In case you weren't aware, If I run Enso using the debug.bat, I get a couple of SyntaxWarnings about invalid escape sequences in web_search.py. I don't think the invalid escapes per se will cause any errors currently on Python 3.12, but it's expected that deprecated syntax will eventually stop working on future Python versions.

The presence of these warnings means it's also possible that the regex wasn't written correctly and isn't working as intended. That's why the invalid escapes were deprecated in the first place. It can help uncover subtle bugs that might otherwise go unnoticed.

GChristensen commented 1 month ago

Hi,

Enso source code itself does not contain deprecated regexses, they all were fixed. This error most likely originates when some dynamically evaluated codes interprets a path as a regex (I have only one such warning on my setup). If you have more, this is probably the case. It is very hard to debug this.

gilch commented 1 month ago
C:\Users\micro\AppData\Roaming\Enso Launcher\commands\web_search.py:81: SyntaxWarning: invalid escape sequence '\:'
  re.compile("(?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~/|/)?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)?"),
C:\Users\micro\AppData\Roaming\Enso Launcher\commands\web_search.py:311: SyntaxWarning: invalid escape sequence '\w'

There's my output, if it helps.

GChristensen commented 1 month ago

Strangely, there is some odd string, probably from the previous version. the correct one is:

re.compile(r"(?#Protocol)(?:(?:ht|f)tp(?:s?):\/\/|~/|/)?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)?"),

GChristensen commented 1 month ago

If you have overwritten the existing installation I'd recommend a clean install, because line 311 in web_search.py seems is pretty innocent in the v1.1.

gilch commented 1 month ago

Yeah, I installed 1.1 without uninstalling 1.0 first. That usually works with most application upgrades and the installer didn't complain. If I use the 1.1 uninstaller, would that uninstall cleanly? I can certainly check the install folder for stray files, but if I have to manually clean up the registry, I wouldn't know where to look.

gilch commented 1 month ago

The warning seems to have disappeared with a reinstall. It used to pop up immediately. The only issue remaining is that the installer didn't catch it or recommend uninstalling first. Not too serious.

GChristensen commented 1 month ago

Actually it recommends, but this was added only in recent versions. It may not work with older ones. So, I close the issue then.