From 0ab15d7930c8bbc1aa22ca268e2f487ae19740ff Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 16 Jan 2014 18:08:24 +0000 Subject: [PATCH] Oops, python 2.7 doesn't have open(..., encoding=). Copied from Perforce Change: 184034 ServerID: perforce.ravenbrook.com --- mps/manual/source/extensions/mps/designs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mps/manual/source/extensions/mps/designs.py b/mps/manual/source/extensions/mps/designs.py index a6d102d34f7..2c909f1d656 100644 --- a/mps/manual/source/extensions/mps/designs.py +++ b/mps/manual/source/extensions/mps/designs.py @@ -91,7 +91,7 @@ def index_sub(m): return s def convert_file(name, source, dest): - s = open(source, encoding='utf-8').read() + s = open(source, 'rb').read().decode('utf-8') # We want the index directive to go right at the start, so that it leads # to the whole document. m = index.search(s) @@ -115,8 +115,8 @@ def convert_file(name, source, dest): os.makedirs(os.path.dirname(dest)) except: pass - with open(dest, mode='w', encoding='utf-8') as out: - out.write(s) + with open(dest, 'wb') as out: + out.write(s.encode('utf-8')) # Mini-make def convert_updated(app):