Repository navigation
feat: a missing image file raises FileNotFoundError, with a short traceback and suggestions - #328
Merged
Merged
Conversation
…ceback and suggestions Image.Read, iread and mvtb_path_to_datafile raised ValueError with a message showing a tuple and a PosixPath, from the bottom of a four-frame traceback. They now raise FileNotFoundError naming the file as written, suggest similar file names from mvtbdata, and Image.Read and iread end the traceback at the call. Code that caught ValueError for a missing file must catch FileNotFoundError. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 16 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Merged
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.
Summary
A missing image file gave a long traceback and an unreadable last line,
file ('images', PosixPath('flowers.png')) not found locally or in mvtbdata (...). It now raisesFileNotFoundErrorwith a message that names the file as written and suggests similar names:Image.Readandireadre-raise the error so the traceback is the caller's line and oneReadframe, not four.mvtb_path_to_datafileand themvtb_load_*loaders raiseFileNotFoundError, as their docstrings already said.ValueErrorfor a missing file now catchFileNotFoundErrortoo: the file picker,imtool,ocrtool,tagtool, the ROS bag loader and one test helper.Image.Readandireadhave.. versionchanged:: 2.5.0notes.Behavior change
Code that catches
ValueErrorfor a missing file must catchFileNotFoundError. This goes in as a plainfeat, with no!. A wildcard that matches nothing still raisesValueError, which I left alone.Testing
Full suite: 2684 passed, 30 skipped, plus one test that expected
ValueError, now updated and passing. mypy is clean. New tests cover the message, the suggestions, the one-frame traceback andiread.This change was written with Claude Code, and I have read the diff.
🤖 Generated with Claude Code