chiadog icon indicating copy to clipboard operation
chiadog copied to clipboard

Pytail exception cause thread exit

Open Sagittarius opened this issue 2 years ago • 2 comments

https://github.com/martomi/chiadog/blob/99cf0bb73ab3d944105f0c83509c9713b5ba07d4/src/chia_log/log_consumer.py#L75

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

Sagittarius avatar Jan 18 '22 02:01 Sagittarius

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

pieterhelsen avatar Jan 18 '22 07:01 pieterhelsen

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

Sagittarius avatar Jan 18 '22 19:01 Sagittarius