Skip to content
This repository was archived by the owner on Oct 25, 2023. It is now read-only.

UnicodeDecodeError when parsing some unicode files. #90

@kyocooro

Description

@kyocooro

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 "):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions