8000 Fix bad commandline handling by WeatherGod · Pull Request #1390 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix bad commandline handling #1390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!
  • Loading branch information
WeatherGod committed Oct 14, 2012
commit ca84f59894b9f62cd528779e7fbe6a6f84c42a57
16 changes: 12 additions & 4 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,14 @@ class Verbose:
_commandLineVerbose = None

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

def __init__(self):
self.set_level('silent')
Expand All @@ -227,8 +233,10 @@ def set_level(self, level):
if self._commandLineVerbose is not None:
level = self._commandLineVerbose
if level not in self.levels:
raise ValueError('Illegal verbose string "%s". Legal values are %s'%(level, self.levels))
self.level = level
warnings.warn('matplotlib: unrecognized --verbose-* string "%s".'
' Legal values are %s' % (level, self.levels))
else:
self.level = level

def set_fileo(self, fname):
std = {
Expand Down
0