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

Skip to content

Commit 6107fb5

Browse files
cgohlkeWeatherGod
authored andcommitted
Fix ValueError: invalid PNG header on Windows
On Windows the `urlparse(...).scheme != ''` test for URLs does not work. For file names the drive letter is returned as scheme.
1 parent c8eea31 commit 6107fb5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ def pilread(fname):
12871287
if cbook.is_string_like(fname):
12881288
parsed = urlparse(fname)
12891289
# If the string is a URL, assume png
1290-
if parsed.scheme != '':
1290+
if len(parsed.scheme) > 1:
12911291
ext = 'png'
12921292
else:
12931293
basename, ext = os.path.splitext(fname)

0 commit comments

Comments
 (0)