apache-log-parser icon indicating copy to clipboard operation
apache-log-parser copied to clipboard

fix bug with regex matching when using Python 3

Open scottwilliambeasley opened this issue 7 years ago • 0 comments
trafficstars

When using Python 3+, the ff error is generated:

File "/home/$USER/.local/lib/python3.6/site-packages/apache_log_parser/__init__.py", line 246, in parse
match = self.log_line_regex.match(log_line)
TypeError: cannot use a string pattern on a bytes-like object 

Python 3+ will return the log_line as a bytes-like object , which will not a compatible with the method signature.

My proposed fix detects if the version of Python is 3+ and then decodes it into utf-8 as necessary.
Fixes #18 and makes the code work as expected on Python 3+.

scottwilliambeasley avatar Apr 08 '18 06:04 scottwilliambeasley