-
Notifications
You must be signed in to change notification settings - Fork 49
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
Improve handling of text decoding errors when scanning imports #242
Comments
found the culprit using this script
|
And this single char was the culprit: |
Thanks for the bug report. While it's a bit difficult to get a file in that state, Import Linter should handle it better - I think, by emitting an error that it could not decode that particular file. To reproduce, we need create a file in a Python codebase that has an Import Linter contract (I used Import Linter itself). This explicitly tells Python what file encoding to expect.
Then open up a Python REPL to write the invalid byte to the end of that file:
Finally, run
The source of the problem can be seen by running the command in debug mode:
I think the fix would be to catch the |
Yep I think just emitting the filename will work :) |
@seddonym I think I misled you a bit! It was the config that had emojis in it 😂 I also didn't know about the --debug flag I was just using --verbose
|
Ah right, thanks! Well, there are obviously a few places where it would be good to surface encoding problems in a friendlier way. |
@Dandiggas has kindly offered to look at this one. |
Can't offer too much more info unfortunately, I literally opened my laptop up in the morning and the same command won't run, quite baffling
The text was updated successfully, but these errors were encountered: