From f5440cc3e1b0523b156a98ff311af61e003e95f9 Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 30 Jul 2014 20:43:34 +0300 Subject: [PATCH] Fixes for Python 3 --- PIL/IptcImagePlugin.py | 4 ++-- Tests/test_file_iptc.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/PIL/IptcImagePlugin.py b/PIL/IptcImagePlugin.py index 955afbbeb..a94fc7524 100644 --- a/PIL/IptcImagePlugin.py +++ b/PIL/IptcImagePlugin.py @@ -237,11 +237,11 @@ def getiptcinfo(im): # extract the IPTC/NAA resource try: app = im.app["APP13"] - if app[:14] == "Photoshop 3.0\x00": + if app[:14] == b"Photoshop 3.0\x00": app = app[14:] # parse the image resource block offset = 0 - while app[offset:offset+4] == "8BIM": + while app[offset:offset+4] == b"8BIM": offset += 4 # resource code code = JpegImagePlugin.i16(app, offset) diff --git a/Tests/test_file_iptc.py b/Tests/test_file_iptc.py index 4ae85c66b..fd68e88b6 100644 --- a/Tests/test_file_iptc.py +++ b/Tests/test_file_iptc.py @@ -38,8 +38,8 @@ class TestFileIptc(PillowTestCase): # Assert self.assertIsInstance(iptc, dict) - self.assertEqual(iptc[(2, 90)], "Budapest") - self.assertEqual(iptc[(2, 101)], "Hungary") + self.assertEqual(iptc[(2, 90)], b"Budapest") + self.assertEqual(iptc[(2, 101)], b"Hungary") # _FIXME: is_raw() is disabled. Should we remove it? def test__is_raw_equal_zero(self): @@ -56,7 +56,7 @@ class TestFileIptc(PillowTestCase): def test_i(self): # Arrange - c = "a" + c = b"a" # Act ret = IptcImagePlugin.i(c)