Fix rawdata[:12] bytes/str comparison

This commit is contained in:
James R. Barlow 2017-08-19 22:04:16 -07:00 committed by Johannes 'josch' Schauer
parent 725462462b
commit b54617de19

View file

@ -671,7 +671,7 @@ def read_images(rawdata, colorspace, first_frame_only=False):
imgdata = Image.open(im) imgdata = Image.open(im)
except IOError as e: except IOError as e:
# test if it is a jpeg2000 image # test if it is a jpeg2000 image
if rawdata[:12] != "\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A": if rawdata[:12] != b"\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A":
raise ImageOpenError("cannot read input image (not jpeg2000). " raise ImageOpenError("cannot read input image (not jpeg2000). "
"PIL: error reading image: %s" % e) "PIL: error reading image: %s" % e)
# image is jpeg2000 # image is jpeg2000