Skip to content

Commit 2d051f2

Browse files
committed
Merge pull request #2657 from minrk/sys-argv-mybad
different fix for comparing sys.argv and unicode literals
2 parents 85fccfe + 5ca8042 commit 2d051f2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/matplotlib/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _forward_ilshift(self, other):
180180

181181

182182
if not hasattr(sys, 'argv'): # for modpython
183-
sys.argv = ['modpython']
183+
sys.argv = [str('modpython')]
184184

185185

186186
from matplotlib.rcsetup import (defaultParams,
@@ -249,8 +249,10 @@ class Verbose:
249249
# --verbose-silent or --verbose-helpful
250250
_commandLineVerbose = None
251251

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

1285-
for s in map(six.u, sys.argv[1:]):
1286-
if s.startswith('-d') and len(s) > 2: # look for a -d flag
1287+
for s in sys.argv[1:]:
1288+
# cast to str because we are using unicode_literals,
1289+
# and argv is always str
1290+
if s.startswith(str('-d')) and len(s) > 2: # look for a -d flag
12871291
try:
12881292
use(s[2:])
12891293
except (KeyError, ValueError):

0 commit comments

Comments
 (0)