Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 04e950a

Browse filesBrowse files
committed
Improve error for quoted values in matplotlibrc.
... as the need for unquoted values in the matplotlibrc is slightly confusing. Also reword the error message to match the one in _check_in_list/_check_getitem.
1 parent f2b6c66 commit 04e950a
Copy full SHA for 04e950a

File tree

Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed

‎lib/matplotlib/rcsetup.py

Copy file name to clipboardExpand all lines: lib/matplotlib/rcsetup.py
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,14 @@ def __call__(self, s):
7272
s = s.lower()
7373
if s in self.valid:
7474
return self.valid[s]
75-
raise ValueError('Unrecognized %s string %r: valid strings are %s'
76-
% (self.key, s, list(self.valid.values())))
75+
msg = (f"{s!r} is not a valid value for {self.key}; supported values "
76+
f"are {[*self.valid.values()]}")
77+
if (isinstance(s, str)
78+
and (s.startswith('"') and s.endswith('"')
79+
or s.startswith("'") and s.endswith("'"))
80+
and s[1:-1] in self.valid):
81+
msg += "; remove quotes surrounding your string"
82+
raise ValueError(msg)
7783

7884

7985
def _listify_validator(scalar_validator, allow_stringlist=False, *, doc=None):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.