From 0eb40c6346ba5b5ed1bdf0710c513c39f7171ccd Mon Sep 17 00:00:00 2001 From: justvanrossum Date: Fri, 24 Nov 2017 16:48:55 +0100 Subject: [PATCH] make poor old afmLib work on py3 --- Lib/fontTools/afmLib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/fontTools/afmLib.py b/Lib/fontTools/afmLib.py index ce52893ea..5df1c1063 100644 --- a/Lib/fontTools/afmLib.py +++ b/Lib/fontTools/afmLib.py @@ -338,7 +338,7 @@ class AFM(object): def readlines(path): f = open(path, 'rb') - data = f.read() + data = f.read().decode("ascii") f.close() # read any text file, regardless whether it's formatted for Mac, Unix or Dos sep = "" @@ -351,7 +351,7 @@ def readlines(path): def writelines(path, lines, sep='\r'): f = open(path, 'wb') for line in lines: - f.write(line + sep) + f.write((line + sep).encode("ascii")) f.close()