10000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e2bffb commit 1d87f34Copy full SHA for 1d87f34
lib/matplotlib/__init__.py
@@ -892,11 +892,17 @@ def is_url(filename):
892
return URL_REGEX.match(filename) is not None
893
894
895
+def _url_lines(f):
896
+ # Compatibility for urlopen in python 3, which yields bytes.
897
+ for line in f:
898
+ yield line.decode(encoding='utf8')
899
+
900
901
@contextlib.contextmanager
902
def _open_file_or_url(fname):
903
if is_url(fname):
904
f = urlopen(fname)
- yield f
905
+ yield _url_lines(f)
906
f.close()
907
else:
908
with open(fname) as f:
0 commit comments