Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation warning due to invalid escape sequences in Python 3.8 #38

Open
tirkarthi opened this issue Jan 31, 2020 · 1 comment
Open

Comments

@tirkarthi
Copy link

find . -iname '*.py'  | xargs -P 4 -I{} python3.8 -Wall -m py_compile {}

./tests/test_pygrok.py:89: DeprecationWarning: invalid escape sequence \[
  pat = '%{HOSTNAME:host} %{IP:client_ip} %{NUMBER:delay}s - \[%{DATA:time_stamp}\]' \
./pygrok/pygrok.py:85: DeprecationWarning: invalid escape sequence \w
  if re.search('%{\w+(:\w+)?}', py_regex_pattern) is None:
@goldstar611
Copy link

Looks like that line is missing the leading r to make it a literal. All of these other lines already have the r:

m = re.findall(r'%{(\w+):(\w+):(\w+)}', py_regex_pattern)

py_regex_pattern = re.sub(r'%{(\w+):(\w+)(?::\w+)?}',

py_regex_pattern = re.sub(r'%{(\w+)}',

It's an easy fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants