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

Skip to content

Commit 02c1c3a

Browse files
committed
Fix ImportError: No module named 'StringIO' on Python 3
1 parent deea685 commit 02c1c3a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

examples/user_interfaces/svg_histogram.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import numpy as np
3636
import matplotlib.pyplot as plt
3737
import xml.etree.ElementTree as ET
38-
from StringIO import StringIO
38+
from io import BytesIO
3939
import json
4040

4141
plt.rcParams['svg.embed_char_paths'] = 'none'
@@ -76,7 +76,7 @@
7676
t.set_gid('leg_text_%d' % i)
7777

7878
# Save SVG in a fake file object.
79-
f = StringIO()
79+
f = BytesIO()
8080
plt.savefig(f, format="svg")
8181

8282
# Create XML tree from the SVG file.

0 commit comments

Comments
 (0)