From 9a1c3915aec0ca5683fd50793a5dd0c018beb780 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 13 Nov 2018 21:45:52 +1100 Subject: [PATCH] Corrected TypeError in Python 3 --- Tests/check_png_dos.py | 2 +- Tests/createfontdatachunk.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Tests/check_png_dos.py b/Tests/check_png_dos.py index 0bbaf6a4d..0cb775aed 100644 --- a/Tests/check_png_dos.py +++ b/Tests/check_png_dos.py @@ -36,7 +36,7 @@ class TestPngDos(PillowTestCase): def test_dos_total_memory(self): im = Image.new('L', (1, 1)) - compressed_data = zlib.compress('a'*1024*1023) + compressed_data = zlib.compress(b'a'*1024*1023) info = PngImagePlugin.PngInfo() diff --git a/Tests/createfontdatachunk.py b/Tests/createfontdatachunk.py index 720fd0067..1a3076da7 100755 --- a/Tests/createfontdatachunk.py +++ b/Tests/createfontdatachunk.py @@ -10,7 +10,9 @@ if __name__ == "__main__": print(" f._load_pilfont_data(") print(" # %s" % os.path.basename(font)) print(" BytesIO(base64.decodestring(b'''") - base64.encode(open(font + ".pil", "rb"), sys.stdout) + with open(font + ".pil", "rb") as fp: + print(base64.b64encode(fp.read()).decode()) print("''')), Image.open(BytesIO(base64.decodestring(b'''") - base64.encode(open(font + ".pbm", "rb"), sys.stdout) + with open(font + ".pbm", "rb") as fp: + print(base64.b64encode(fp.read()).decode()) print("'''))))")