Skip to content

Commit bd71341

Browse files
committed
cast argv to unicode before testing
otherwise the use of `unicode-literals` causes errors when there are non-ascii characters on argv on Python 2.
1 parent dab724a commit bd71341

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class Verbose:
243243
# --verbose-silent or --verbose-helpful
244244
_commandLineVerbose = None
245245

246-
for arg in sys.argv[1:]:
246+
for arg in map(six.u, sys.argv[1:]):
247247
if not arg.startswith('--verbose-'):
248248
continue
249249
level_str = arg[10:]
@@ -1212,7 +1212,7 @@ def tk_window_focus():
12121212
# Allow command line access to the backend with -d (MATLAB compatible
12131213
# flag)
12141214

1215-
for s in sys.argv[1:]:
1215+
for s in map(six.u, sys.argv[1:]):
12161216
if s.startswith('-d') and len(s) > 2: # look for a -d flag
12171217
try:
12181218
use(s[2:])

0 commit comments

Comments
 (0)