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

UnicodeDecodeError issue: line 1112, src/jurigged/codetools.py #47

Open
FateUnix29 opened this issue Jan 16, 2025 · 0 comments
Open

UnicodeDecodeError issue: line 1112, src/jurigged/codetools.py #47

FateUnix29 opened this issue Jan 16, 2025 · 0 comments

Comments

@FateUnix29
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant