jurigged
jurigged copied to clipboard
UnicodeDecodeError issue: line 1112, src/jurigged/codetools.py
There's a (seemingly) rare issue where the f.read() call within the with open() statement causes a UnicodeDecodeError on line 1112, in function read_source (line 1110).
I'm not quite sure where the error refers to is, as there's no traceback into my own source files. It only gave me a character position I don't remember.
I cannot find any other issues on this.
In order to fix this issue, I patched jurigged by modifying the with open() statement in this function (though I'll send the entire function for context):
def read_source(self):
with open(self.filename, "r", encoding="utf-8", errors="replace") as f:
source = f.read()
if not source.endswith("\n"):
source += "\n"
return source