Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

fix bug with regex matching when using Python 3 #24

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

scottwilliambeasley
Copy link

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+.

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

Successfully merging this pull request may close these issues.

python3 compatible?
1 participant