Prints a bunch of syntax warnings

Bug #2061229 reported by Egmont Koblinger
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
itstool (Ubuntu)
New
Undecided
Unassigned

Bug Description

24.04 beta, fully updated.

Simply start 'itstool'. Notice how it spits out a lot of syntax warnings:

  /usr/bin/itstool:239: SyntaxWarning: invalid escape sequence '\s'
    if re.sub('\s+', ' ', text).strip() != '':
  /usr/bin/itstool:337: SyntaxWarning: invalid escape sequence '\s'
    message = re.sub('\s+', ' ', message).strip()
  /usr/bin/itstool:475: SyntaxWarning: invalid escape sequence '\s'
    return re.sub('\s+', ' ', self.locnote).strip()
  /usr/bin/itstool:477: SyntaxWarning: invalid escape sequence '\s'
    return '(itstool) link: ' + re.sub('\s+', ' ', self.locnoteref).strip()
  /usr/bin/itstool:891: SyntaxWarning: invalid escape sequence '\<'
    regex = re.compile('(.*) \<(.*)\>, (.*)')
  /usr/bin/itstool:926: SyntaxWarning: invalid escape sequence '\s'
    if re.sub('\s+', '', prevtext) == '':
  /usr/bin/itstool:1452: SyntaxWarning: invalid escape sequence '\.'
    _locale_pattern = re.compile('([a-zA-Z0-9-]+)(_[A-Za-z0-9]+)?(@[A-Za-z0-9]+)?(\.[A-Za-z0-9]+)?')

I don't know if these invalid escape sequences in turn cause any actual misbehavior.

(I noticed these warnings while compiling gnome-terminal. These weren't there in 23.10.)

Tags: noble
summary: - Prints a bunch of syntax warning
+ Prints a bunch of syntax warnings
description: updated
Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

itstool didn't change from 23.10, python3 did.

This article seems relevant: https://adamj.eu/tech/2022/11/04/why-does-python-deprecationwarning-invalid-escape-sequence/

and it also claims that python 3.11 already gave warnings if you asked for it (which wasn't the default), but with python 3.12+ these warnings are enabled by default.

Anyway, itstool is using some Python regex stuff incorrectly.

Revision history for this message
Egmont Koblinger (egmont-gmail) wrote :

Filed upstream bug https://github.com/itstool/itstool/issues/54, but upstream has been unmaintained for 2.5 years, not sure if we can expect a quick "official" fix.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.