Skip to content

Commit 4f62f84

Browse files
tacaswellMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR #9292: Fix TypeError: a bytes-like object is required, not 'str'
1 parent aaecec4 commit 4f62f84

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/matplotlib/dviread.py

+8
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,14 @@ def find_tex_file(filename, format=None):
10301030
The library that :program:`kpsewhich` is part of.
10311031
"""
10321032

1033+
if six.PY3:
1034+
# we expect these to always be ascii encoded, but use utf-8
1035+
# out of caution
1036+
if isinstance(filename, bytes):
1037+
filename = filename.decode('utf-8', errors='replace')
1038+
if isinstance(format, bytes):
1039+
format = format.decode('utf-8', errors='replace')
1040+
10331041
cmd = [str('kpsewhich')]
10341042
if format is not None:
10351043
cmd += ['--format=' + format]

0 commit comments

Comments
 (0)