Repository navigation
wxGUI: Add the matplotlib hint as an exception note - #7688
Merged
Merged
Conversation
The Scatterplot, Timeline, and Temporal Plot tools raised a new ImportError with the hint as its message, so the message of the original error, which says which module is actually missing, was replaced by the hint. Add the hint as a note to the original error instead. From the Python documentation of BaseException.add_note(): "Add the string note to the exception's notes which appear in the standard traceback after the exception string." The traceback then shows both the missing module and the hint. Exception notes need Python 3.11, which is now the minimum version.
echoix
approved these changes
Jul 14, 2026
echoix
pushed a commit
to wenzeslaus/grass
that referenced
this pull request
Jul 14, 2026
The Scatterplot, Timeline, and Temporal Plot tools raised a new ImportError with the hint as its message, so the message of the original error, which says which module is actually missing, was replaced by the hint. Add the hint as a note to the original error instead. From the Python documentation of BaseException.add_note(): Add the string note to the exception's notes which appear in the standard traceback after the exception string. The traceback then shows both the missing module and the hint. The consumer code (various places) shows always its own message, so the not, not the original message is not used. These changes do not change that. Exception notes need Python 3.11, which is now the minimum version.
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.
Now, the Scatterplot, Timeline, and Temporal Plot tools raise a new
ImportErrorwhose message is the hint, with the original error appended to it using.format(e).Add the hint as a note to the original error instead. From the Python documentation of
BaseException.add_note(): "Add the stringnoteto the exception's notes which appear in the standard traceback after the exception string."Starting a tool without matplotlib then gives a single exception with the actual error as its message and the hint after it, instead of a chained pair of exceptions:
Nothing else is affected, because the tools are started with a plain
except ImportErrorin main_window and lmgr which shows its own message and uses neither the message nor the traceback of the error.A note is shown only in a traceback, never in
str(exception), so this is not applicable where the caller prints the message, for example r.in.wms withgs.fatal().Exception notes need Python 3.11, which is now the minimum version (discussed in #4032). This touches the same lines as #4032, so whichever is merged second needs a trivial conflict resolution.
Commit message
The Scatterplot, Timeline, and Temporal Plot tools raised a new ImportError
with the hint as its message, so the message of the original error, which
says which module is actually missing, was replaced by the hint.
Add the hint as a note to the original error instead. From the Python
documentation of BaseException.add_note(): Add the string note to the
exception's notes which appear in the standard traceback after the exception
string. The traceback then shows both the missing module and the hint.
The consumer code (various places) shows always its own message, so the
not, not the original message is not used. These changes do not change that.
Exception notes need Python 3.11, which is now the minimum version.