Title: Error reading png image from URL with imread in matplotlib 3.3 · Issue #18129 · matplotlib/matplotlib · GitHub
Open Graph Title: Error reading png image from URL with imread in matplotlib 3.3 · Issue #18129 · matplotlib/matplotlib
X Title: Error reading png image from URL with imread in matplotlib 3.3 · Issue #18129 · matplotlib/matplotlib
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'...
Open Graph 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/c...
X 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/hjnilss...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/18129
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error reading png image from URL with imread in matplotlib 3.3","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\n\r\nAfter upgrading to matplotlib 3.3, `imread` errors when reading in a png from a URL. This was working in 3.2.\r\n\r\n```python\r\nfrom matplotlib import image\r\nurl = 'https://github.com/hjnilsson/country-flags/raw/master/png250px/us.png'\r\nimage.imread(url)\r\n```\r\n\r\nResults in `UnsupportedOperation: seek`\r\n\r\nTraceback indicates error is from pillow. [Related Issue](https://github.com/imageio/imageio/issues/202)\r\n\r\n**Full Traceback**\r\n\r\n```\r\nUnsupportedOperation Traceback (most recent call last)\r\n\u003cipython-input-28-3cc23b6666a9\u003e in \u003cmodule\u003e\r\n----\u003e 1 image.imread(url)\r\n\r\n~/miniconda3/envs/mpl/lib/python3.8/site-packages/matplotlib/image.py in imread(fname, format)\r\n 1473 from urllib import request\r\n 1474 with urllib.request.urlopen(fname) as response:\r\n-\u003e 1475 return imread(response, format=ext)\r\n 1476 with img_open(fname) as image:\r\n 1477 return (_pil_png_to_float_array(image)\r\n\r\n~/miniconda3/envs/mpl/lib/python3.8/site-packages/matplotlib/image.py in imread(fname, format)\r\n 1474 with urllib.request.urlopen(fname) as response:\r\n 1475 return imread(response, format=ext)\r\n-\u003e 1476 with img_open(fname) as image:\r\n 1477 return (_pil_png_to_float_array(image)\r\n 1478 if isinstance(image, PIL.PngImagePlugin.PngImageFile) else\r\n\r\n~/miniconda3/envs/mpl/lib/python3.8/site-packages/PIL/ImageFile.py in __init__(self, fp, filename)\r\n 115 try:\r\n 116 try:\r\n--\u003e 117 self._open()\r\n 118 except (\r\n 119 IndexError, # end of data\r\n\r\n~/miniconda3/envs/mpl/lib/python3.8/site-packages/PIL/PngImagePlugin.py in _open(self)\r\n 651 # get next chunk\r\n 652 \r\n--\u003e 653 cid, pos, length = self.png.read()\r\n 654 \r\n 655 try:\r\n\r\n~/miniconda3/envs/mpl/lib/python3.8/site-packages/PIL/PngImagePlugin.py in read(self)\r\n 126 s = self.fp.read(8)\r\n 127 cid = s[4:]\r\n--\u003e 128 pos = self.fp.tell()\r\n 129 length = i32(s)\r\n 130 \r\n\r\nUnsupportedOperation: seek\r\n```\r\n\r\n\r\n\u003c!--A description of the expected outcome from the code snippet--\u003e\r\n\u003c!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on--\u003e\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: macOS\r\n * Matplotlib version: 3.3\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): MacOSX\r\n * Python version: 3.8\r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\n\r\n","author":{"url":"https://github.com/tdpetrou","@type":"Person","name":"tdpetrou"},"datePublished":"2020-07-30T16:39:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":23},"url":"https://github.com/18129/matplotlib/issues/18129"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:aa6bcb2f-a565-bb5c-ce0d-4a3516225267 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8DBC:203A5F:10B7513:16E3DE5:6A53BE2D |
| html-safe-nonce | 82b3fba8e3418fcd54707b51f396f1c38002ec484129935a327c970a2e3af727 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4REJDOjIwM0E1RjoxMEI3NTEzOjE2RTNERTU6NkE1M0JFMkQiLCJ2aXNpdG9yX2lkIjoiOTEyNjI2MTMxMTk1MjYzMzM4OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7277b25a5f25130c02afb311f673596f2a6627c03e37221d5d5ab6829a93be0f |
| hovercard-subject-tag | issue:668950460 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/18129/issue_layout |
| twitter:image | https://opengraph.githubassets.com/312181ea9ac01193ce1659cdc215b5ddc5f5d954966bf9ccde90e5128c099168/matplotlib/matplotlib/issues/18129 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/312181ea9ac01193ce1659cdc215b5ddc5f5d954966bf9ccde90e5128c099168/matplotlib/matplotlib/issues/18129 |
| og:image:alt | 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/c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tdpetrou |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width