systeminformer icon indicating copy to clipboard operation
systeminformer copied to clipboard

UnicodeDecodeError when parsing some unicode files.

Open kyocooro opened this issue 3 years ago • 2 comments

File "/usr/local/lib/python3.9/dist-packages/whispers/utils.py", line 104, in find_line_number for line_number, line in enumerate(filepath.open().readlines(), 1): File "/usr/lib/python3.9/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 0: invalid start byte

File "/usr/local/lib/python3.9/dist-packages/whispers/plugins/init.py", line 60, in load_plugin if self.filepath.open("r").readline().startswith("<?xml "): File "/usr/lib/python3.9/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbc in position 21: invalid start byte

Fix: utils.py: for line_number, line in enumerate(filepath.open(errors='ignore').readlines(), 1):

whispers/plugins/init.py: if self.filepath.open("r", errors='ignore').readline().startswith("<?xml "):

kyocooro avatar Nov 13 '21 01:11 kyocooro

hey @kyocooro thanks for raising. It is a known bug, and is addressed in the v2 release that is coming up shortly. regards

adeptex avatar Nov 15 '21 16:11 adeptex

Version 2 is here: https://github.com/adeptex/whispers

See release notes: https://github.com/adeptex/whispers/blob/master/RELEASE_NOTES.md

Cheers!

adeptex avatar Feb 21 '22 23:02 adeptex