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

fix bug with regex matching when using Python 3+ #1

Merged
merged 1 commit into from
Apr 8, 2018

Conversation

scottwilliambeasley
Copy link
Owner

@scottwilliambeasley scottwilliambeasley commented Apr 8, 2018

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.
Makes the code work as expected on Python 3+.

@scottwilliambeasley scottwilliambeasley merged commit d02204a into master Apr 8, 2018
@scottwilliambeasley scottwilliambeasley deleted the scottwilliambeasley-patch-1 branch April 8, 2018 06:23
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

Successfully merging this pull request may close these issues.

1 participant