Fix: render_terminal_png.py leaks raw traceback for missing input file - #476
Merged
yakew7 merged 1 commit intoSep 7, 2026
Merged
Conversation
Wrap the input file read in a try/except FileNotFoundError and print an 'error: <path> not found' message with exit code 2, matching the existing usage-error style, instead of leaking a raw traceback. Closes yakew7#460
Contributor
|
@AchieverSana is attempting to deploy a commit to the yashkewlani2020-gmailcom's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Hey @AchieverSana, your first PR on Fair Code, that's awesome, thank you. This project is about making AI more accountable, and contributions like yours are what keep that work going. We'll review your changes shortly. If you haven't already, give the contributing guide a quick read: it covers how audits are structured and what we look for in a review. And if you're finding Fair Code useful or interesting, a star on the repo genuinely helps more people find it - no pressure, just appreciated. |
ahmdkaml
approved these changes
Sep 7, 2026
Collaborator
|
the description of the issue requires a regression test but the implementation is ok |
yakew7
added a commit
that referenced
this pull request
Sep 7, 2026
…loses #460) The merged PR's except FileNotFoundError only covered a missing/moved path; passing a directory instead of a file (IsADirectoryError, a sibling OSError subclass) still leaked a raw traceback. Widened to except OSError and used the OS's own strerror so the message stays accurate for either case ("No such file or directory" vs "Is a directory") instead of hardcoding "not found" for both. The PR also shipped with no test coverage of its own - added tests for both the missing-file and directory cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
render_terminal_png.pyto handle missing input files cleanly instead of leaking a raw Python traceback.Summary
Handles missing input files gracefully by printing
error: <path> not foundto stderr and exiting with code 2, matching the script's existing usage-error behavior.Type
Audit checklist
unfair.pyincludes protected attributes and prints the required output formatfair.pyremoves protected attributes and identified proxy variablesrandom_state=42and an 80/20 train/test splitunfair.pngandfair.pngare included as PNG screenshotsDATA.mdis included if the file is too largeREADME.mdincludes the new results row and audit sectionBefore fairness gap:
After fairness gap:
Reduction:
Protected attribute(s):
Proxy variables dropped:
Explainer checklist
explainers/and uses lowercase hyphenated namingREADME.mdwas updatedLinked issue
Closes #460