tamentis / cartman

Command line Trac tools
http://tamentis.com/projects/cartman/
ISC License
22 stars 10 forks source link

SyntaxWarning: invalid escape sequence '\d' #39

Open ryandesign opened 8 months ago

ryandesign commented 8 months ago

When using python 3.12, this warning appears:

% cm -h
/opt/local/bin/cm:53: SyntaxWarning: invalid escape sequence '\d'
  m = re.match(".*#(\d+).*", data, flags=(re.MULTILINE|re.DOTALL))
usage: cm [-h] [-c] [-m MESSAGE] [-i] [--message-file MESSAGE_FILE] [-a] [-s SITE] [-t TEMPLATE] command [parameters ...]

positional arguments:
  command               required (try help)
  parameters            specific for each commands

options:
  -h, --help            show this help message and exit
  -c                    add a comment via the editor (status)
  -m MESSAGE            comment/message to be added (status, comment)
  -i                    grab ticket_id from stdin
  --message-file MESSAGE_FILE
                        read message from file/stdin, disable editor
  -a                    open ticket in browser after command
  -s SITE               what site to use (default: trac)
  -t TEMPLATE           template to use for new tickets

This does not happen when using python 3.11.

I understand the solution is to use raw strings. See https://docs.python.org/3/library/re.html.