From b54617de19649c23780af8729b9912e812b62d98 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sat, 19 Aug 2017 22:04:16 -0700 Subject: [PATCH] Fix rawdata[:12] bytes/str comparison --- src/img2pdf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/img2pdf.py b/src/img2pdf.py index d3b1442..2ac4b16 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -671,7 +671,7 @@ def read_images(rawdata, colorspace, first_frame_only=False): imgdata = Image.open(im) except IOError as e: # 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). " "PIL: error reading image: %s" % e) # image is jpeg2000