Closed
Description
Bug report
Bug summary
After upgrading to matplotlib 3.3, imread
errors when reading in a png from a URL. This was working in 3.2.
from matplotlib import image
url = 'https://github.com/hjnilsson/country-flags/raw/master/png250px/us.png'
image.imread(url)
Results in UnsupportedOperation: seek
Traceback indicates error is from pillow. Related Issue
Full Traceback
UnsupportedOperation Traceback (most recent call last)
<ipython-input-28-3cc23b6666a9> in <module>
----> 1 image.imread(url)
~/miniconda3/envs/mpl/lib/python3.8/site-packages/matplotlib/image.py in imread(fname, format)
1473 from urllib import request
1474 with urllib.request.urlopen(fname) as response:
-> 1475 return imread(response, format=ext)
1476 with img_open(fname) as image:
1477 return (_pil_png_to_float_array(image)
~/miniconda3/envs/mpl/lib/python3.8/site-packages/matplotlib/image.py in imread(fname, for
5F42
mat)
1474 with urllib.request.urlopen(fname) as response:
1475 return imread(response, format=ext)
-> 1476 with img_open(fname) as image:
1477 return (_pil_png_to_float_array(image)
1478 if isinstance(image, PIL.PngImagePlugin.PngImageFile) else
~/miniconda3/envs/mpl/lib/python3.8/site-packages/PIL/ImageFile.py in __init__(self, fp, filename)
115 try:
116 try:
--> 117 self._open()
118 except (
119 IndexError, # end of data
~/miniconda3/envs/mpl/lib/python3.8/site-packages/PIL/PngImagePlugin.py in _open(self)
651 # get next chunk
652
--> 653 cid, pos, length = self.png.read()
654
655 try:
~/miniconda3/envs/mpl/lib/python3.8/site-packages/PIL/PngImagePlugin.py in read(self)
126 s = self.fp.read(8)
127 cid = s[4:]
--> 128 pos = self.fp.tell()
129 length = i32(s)
130
UnsupportedOperation: seek
Matplotlib version
- Operating system: macOS
- Matplotlib version: 3.3
- Matplotlib backend (
print(matplotlib.get_backend())
): MacOSX - Python version: 3.8