Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 64b81aa

Browse files
committed
Fix exception_to_str to work on Python 2.x
1 parent 9877224 commit 64b81aa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/cbook.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,8 +987,10 @@ def pieces(seq, num=2):
987987

988988

989989
def exception_to_str(s=None):
990-
991-
sh = io.StringIO()
990+
if sys.version_info[0] < 3:
991+
sh = io.BytesIO()
992+
else:
993+
sh = io.StringIO()
992994
if s is not None:
993995
print(s, file=sh)
994996
traceback.print_exc(file=sh)

0 commit comments

Comments
 (0)