8000 Merge pull request #1390 from WeatherGod/cmdline_fix · matplotlib/matplotlib@82bc93e · GitHub
[go: up one dir, main page]

Skip to content

Commit 82bc93e

Browse files
committed
Merge pull request #1390 from WeatherGod/cmdline_fix
Fix bad commandline handling
2 parents 53fd0d3 + ca84f59 commit 82bc93e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/matplotlib/__init__.py

Lines 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