ctjacobs / pyqso

PyQSO is a contact logging tool for amateur radio operators.
http://christianjacobs.uk/pyqso
GNU General Public License v3.0
79 stars 19 forks source link

SyntaxWarning: invalid escape sequence '\d' #79

Open pabutusa opened 2 weeks ago

pabutusa commented 2 weeks ago
Python 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import adif
/home/roschews/pyqso/pyqso/adif.py:272: SyntaxWarning: invalid escape sequence '\d'
  pattern = re.compile("<(.*?):(\d*).*?>([^<]+)")

I'm really not great at REGEX .... but should the \d be a \\d ??

According to the google: Back in Python 3.6, using invalid escape sequences in string literals was deprecated (bpo-27364).

auslaner commented 2 weeks ago

I believe it would work to just preface the string with an 'r' to denote it as a raw string.

pattern = re.compile(r"<(.*?):(\d*).*?>([^<]+)")

tomswartz07 commented 1 week ago

👋🏻 I made a PR (which will probably not be merged- it looks like this project is loong abandoned) which fixes this problem.

I'll probably continue to work on changes in my fork: https://github.com/tomswartz07/pyqso

pabutusa commented 1 week ago

Thanks!