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 ca84f59

Browse filesBrowse files
committed
Fix bad commandline handling. Closes issue #1306
Don't raise an exception if the --verbose-* doesn't match one of our strings. It might not be intended for us!
1 parent 9b7abbf commit ca84f59
Copy full SHA for ca84f59

File tree

Expand file treeCollapse file tree

1 file changed

+12
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-4
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+12-4Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,14 @@ class Verbose:
214214
_commandLineVerbose = None
215215

216216
for arg in sys.argv[1:]:
217-
if not arg.startswith('--verbose-'): continue
218-
_commandLineVerbose = arg[10:]
217+
if not arg.startswith('--verbose-'):
218+
continue
219+
level_str = arg[10:]
220+
# If it doesn't match one of ours, then don't even
221+
# bother noting it, we are just a 3rd-party library
222+
# to somebody else's script.
223+
if level_str in levels:
224+
_commandLineVerbose = level_str
219225

220226
def __init__(self):
221227
self.set_level('silent')
@@ -227,8 +233,10 @@ def set_level(self, level):
227233
if self._commandLineVerbose is not None:
228234
level = self._commandLineVerbose
229235
if level not in self.levels:
230-
raise ValueError('Illegal verbose string "%s". Legal values are %s'%(level, self.levels))
231-
self.level = level
236+
warnings.warn('matplotlib: unrecognized --verbose-* string "%s".'
237+
' Legal values are %s' % (level, self.levels))
238+
else:
239+
self.level = level
232240

233241
def set_fileo(self, fname):
234242
std = {

0 commit comments

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