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

Pytail exception cause thread exit #327

Open
Sagittarius opened this issue Jan 18, 2022 · 2 comments
Open

Pytail exception cause thread exit #327

Sagittarius opened this issue Jan 18, 2022 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Sagittarius
Copy link

for log_line in Pygtail(self._expanded_log_path, read_from_end=True, offset_file=self._offset_path):

If there is some non-utf8(like GBK) character, here will throw exception, then make thread exit.
I want to make a pr, but I am not good at pyhon, can't fix it.
Thx

@pieterhelsen
Copy link
Collaborator

Can you paste the stack trace or the name of the exception?

@Sagittarius
Copy link
Author

Sagittarius commented Jan 18, 2022

Here is stack trace. Thx man

[2022-01-19 03:59:16] [   ERROR] --- 'utf-8' codec can't decode byte 0xb6 in position 424: invalid start byte (log_consumer.py:79)

Traceback (most recent call last):

  File "/chiadog/src/chia_log/log_consumer.py", line 76, in _consume_loop

    for log_line in Pygtail(self._expanded_log_path, read_from_end=True, offset_file=self._offset_path):

  File "/chiadog/venv/lib/python3.10/site-packages/pygtail/core.py", line 136, in __next__

    return self.next()

  File "/chiadog/venv/lib/python3.10/site-packages/pygtail/core.py", line 108, in next

    line = self._get_next_line()

  File "/chiadog/venv/lib/python3.10/site-packages/pygtail/core.py", line 280, in _get_next_line

    line = self._filehandle().readline()

  File "/usr/local/lib/python3.10/codecs.py", line 322, in decode

    (result, consumed) = self._buffer_decode(data, self.errors, final)

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 424: invalid start byte

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants