lclarkmichalek / archey3

Simple python script to print the Archlinux logo with basic system information.
http://bluepeppers.github.com/archey3
Other
62 stars 27 forks source link

SyntaxWarning: invalid escape sequence '\s' #53

Open Aster89 opened 4 months ago

Aster89 commented 4 months ago

Has something recently changed in Python? I've not consciously changed anything on my system that could affect archey3 the way I describe below.

Whenever I execute archey3 I get this warning before the usual output:

/usr/bin/archey3:332: SyntaxWarning: invalid escape sequence '\s'
  info = [re.sub("\s\s+", "", line) for line in line.split('  ') if\
/usr/bin/archey3:697: SyntaxWarning: invalid escape sequence '\w'
  DISPLAY_PARSING_REGEX = "(?P<func>\w+)\((|(?P<args>[\w, /]+))\)"

the lines are these https://github.com/lclarkmichalek/archey3/blob/ac687529ec6208954f09c29f01760c66f73b1d10/archey3#L332-L333 and this https://github.com/lclarkmichalek/archey3/blob/ac687529ec6208954f09c29f01760c66f73b1d10/archey3#L697 and prepending r to the first "string" of both lines solves the problem.

I can make a PR if this project is still alive.

vEnhance commented 4 months ago

The SyntaxWarning is new to Python 3.12 and I've been getting the same warning too.

I agree a PR here would make sense (with the obvious disclaimer that I'm not the maintainer of the package, just a fellow user).

Aster89 commented 4 months ago

@vEnhance , let's wait for some of the maintainers to reply.

HorlogeSkynet commented 4 months ago

@vEnhance , let's wait for some of the maintainers to reply.

It's very unlikely. This project has been abandoned for a while now (see https://github.com/lclarkmichalek/archey3/issues/47). I (modestly) invite you to check out HorlogeSkynet/archey4, which is actively maintained (and compatible against Python 3.12).

Bye :wave:

eduarddejong commented 4 months ago

I noticed it too (actually I was questioning what the old .archey3.cfg file was doing in my user home folder, and if I could clean things up, and that made me searching further for this thing on my system). Running it gave the same errors for me. Copying the script from /usr/bin to another folder and then fixing it clearly helped (I just duplicated the backslashes, but adding the r for raw string is actually even better), but I don't plan to keep it.

Turns out in my case, it was also still sitting on my Arch Linux system, but in the case I have installed it from the official Arch repos (no idea), it's no longer there either. This may be the case for other people as well. But maybe it was just from AUR. I see that currently both archey3 and archey4 are available on the AUR.

vEnhance commented 4 months ago

It used to be in the main repository but got orphaned and then dropped down to AUR about six weeks ago: https://lists.archlinux.org/archives/list/aur-general@lists.archlinux.org/thread/MHVWGPV6VEC7KRDYYMQHKGHTO6JJH7NS/ Because of this, there's actually now both archey3 and archey3-git in AUR, which is probably confusing things further :)

A few weeks ago I actually adopted the AUR package and then patched the issue at https://aur.archlinux.org/cgit/aur.git/tree/py312-syntax-warning.patch?h=archey3, but it would of course be better to have that change merged upstream. But that requires the maintainer.