cheetah3 icon indicating copy to clipboard operation
cheetah3 copied to clipboard

A bunch of DeprecationWarnings when running in development mode

Open CendioOssman opened this issue 4 years ago • 5 comments
trafficstars

We try to use Python's development mode to get early warnings about stuff in our code. However we're also getting these DeprecationWarnings from Cheetah:

/opt/thinlinc/modules/Cheetah/Template.py:142: DeprecationWarning: invalid escape sequence \*
  '''
/opt/thinlinc/modules/Cheetah/Template.py:1617: DeprecationWarning: invalid escape sequence \*
  """Compile the template. This method is automatically called by
/opt/thinlinc/modules/Cheetah/Template.py:1728: DeprecationWarning: invalid escape sequence \*
  """Method for importing web transaction variables in bulk.
/opt/thinlinc/modules/Cheetah/Template.py:1984: DeprecationWarning: invalid escape sequence \d
  re.search('[ \t]*File.*line (\d+)', formatedExc).group(1))
/opt/thinlinc/modules/Cheetah/Template.py:2025: DeprecationWarning: invalid escape sequence \d
  cheetahPosMatch = re.search('line (\d+), col (\d+)', formatedExc)
/opt/thinlinc/modules/Cheetah/Template.py:2035: DeprecationWarning: invalid escape sequence \d
  cheetahPosMatch = re.search('line (\d+), col (\d+)',
/opt/thinlinc/modules/Cheetah/SettingsManager.py:19: DeprecationWarning: invalid escape sequence \(
  '[\(]*' + Number + r'[ \t]*\+[ \t]*' + Number + '[\)]*')
/opt/thinlinc/modules/Cheetah/SettingsManager.py:19: DeprecationWarning: invalid escape sequence \)
  '[\(]*' + Number + r'[ \t]*\+[ \t]*' + Number + '[\)]*')
/opt/thinlinc/modules/Cheetah/Parser.py:464: DeprecationWarning: invalid escape sequence \*
  + r'(?P<REFRESH_CACHE>\*' + interval + '\*)'
/opt/thinlinc/modules/Cheetah/Parser.py:557: DeprecationWarning: invalid escape sequence \$
  """Unescape any escaped Cheetah \$vars in the string.
/opt/thinlinc/modules/Cheetah/SourceReader.py:8: DeprecationWarning: invalid escape sequence \s
  ENCODINGsearch = re.compile("coding[=:]\s*([-\w.]+)").search

Not sure if they indicate a real issue, but it would be nice to get rid of them to make development mode easier to use.

CendioOssman avatar Dec 04 '20 11:12 CendioOssman

Python version? Cheetah version? How have you installed Cheetah?

phdru avatar Dec 05 '20 16:12 phdru

Seen on Fedora 32, so python3-3.8.6-1.fc32.x86_64. Cheetah commit a6fb302197444eb5bc42f74da5d272eeb97582d7, manually copied in to a directory in $PYTHONPATH.

CendioOssman avatar Dec 07 '20 08:12 CendioOssman

Python 3.6 added a DeprecationWarning for invalid escape sequences. The affected strings should probably be changed to raw strings. There appears to be a Flake8 rule for this.

0 avatar Feb 19 '21 01:02 0

The error code was disabled in 6758df2. Don't forget to remove it from setup.cfg in your pull request.

phdru avatar Feb 19 '21 21:02 phdru

I've finished migration yo Github Actions. Your pull request will be automatically tested.

phdru avatar Oct 10 '22 13:10 phdru

It looks like this was fixed in 31a907d?

CendioOssman avatar Dec 29 '23 13:12 CendioOssman

It looks like this was fixed in 31a907d?

Perhaps. Do you want to test and close the issue?

phdru avatar Dec 29 '23 15:12 phdru

I tested the 3.3.3 release, and I'm not getting any more warnings here. Seems to be resolved. :)

CendioOssman avatar Jan 02 '24 09:01 CendioOssman

Thank you for testing and reporting!

phdru avatar Jan 02 '24 11:01 phdru