To get gedit working on Ubuntu 24.04.01 you must change string to raw :

```bash
michaellaunay@Caravale:~$ sudo dpkg-reconfigure gedit
​/usr/lib/x86_64-linux-gnu/gedit/plugins/externaltools/library.py:212: 
SyntaxWarning: invalid escape sequence '\-' and'\['
  RE_KEY = re.compile('^([a-zA-Z_][a-zA-Z0-9_.\-]*)(\[([a-zA-Z_@]+)\])?$')
​/usr/lib/x86_64-linux-gnu/gedit/plugins/snippets/substitutionparser.py:162: 
SyntaxWarning: invalid escape sequence '\s'
  match = re.match('\\?%s\s*' % self.REG_GROUP, tokens)
```

The "SyntaxWarning" warnings are due to invalid escape sequences in the
strings within the Python scripts. These warnings appear when an escape
sequence like '\-' or `\[` or `\s` is used without the string being
marked as a raw string.

To fix these warnings, the affected strings need to be converted into
raw strings by adding an `r` before the quotation marks. Here’s how to
correct the two problematic lines in the mentioned Python files:

1. File `library.py`, line 212:

   Before the correction:

```Python
   RE_KEY = re.compile('^([a-zA-Z_][a-zA-Z0-9_.\-]*)(\[([a-zA-Z_@]+)\])?$')
```

   After the correction:
```Python
   RE_KEY = re.compile(r'^([a-zA-Z_][a-zA-Z0-9_.\-]*)(\[([a-zA-Z_@]+)\])?$')
```

2. File `substitutionparser.py`, line 162:

   Before the correction:
```Python
   match = re.match('\\?%s\s*' % self.REG_GROUP, tokens)
```

   After the correction:
```python
   match = re.match(r'\\?%s\s*' % self.REG_GROUP, tokens)
```

I manually edited these files to apply the corrections.

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to gedit in Ubuntu.
https://bugs.launchpad.net/bugs/2061211

Title:
  Invalid escape sequences in regexes when installing gedit

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gedit/+bug/2061211/+subscriptions


-- 
desktop-bugs mailing list
desktop-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to