Skip to content

different fix for comparing sys.argv and unicode literals #2657

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
Dec 13, 2013
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
14 changes: 9 additions & 5 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def _forward_ilshift(self, other):


if not hasattr(sys, 'argv'): # for modpython
sys.argv = ['modpython']
sys.argv = [str('modpython')]


from matplotlib.rcsetup import (defaultParams,
Expand Down Expand Up @@ -249,8 +249,10 @@ class Verbose:
# --verbose-silent or --verbose-helpful
_commandLineVerbose = None

for arg in map(six.u, sys.argv[1:]):
if not arg.startswith('--verbose-'):
for arg in sys.argv[1:]:
# cast to str because we are using unicode_literals,
# and argv is always str
if not arg.startswith(str('--verbose-')):
continue
level_str = arg[10:]
# If it doesn't match one of ours, then don't even
Expand Down Expand Up @@ -1282,8 +1284,10 @@ def tk_window_focus():
# Allow command line access to the backend with -d (MATLAB compatible
# flag)

for s in map(six.u, sys.argv[1:]):
if s.startswith('-d') and len(s) > 2: # look for a -d flag
for s in sys.argv[1:]:
# cast to str because we are using unicode_literals,
# and argv is always str
if s.startswith(str('-d')) and len(s) > 2: # look for a -d flag
try:
use(s[2:])
except (KeyError, ValueError):
Expand Down