From ec92bbba5dbb9733f26c0f5887702ec73f76f566 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 6 Feb 2020 10:53:45 +1000 Subject: proposals: Update reindex.py for Python 3 Add the standard future statements, so Python 2 will use some Python 3 features. Open files as UTF-8. As a consequence of this change, proposals must be encoded in UTF-8. Closes ticket 33164. --- proposals/reindex.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'proposals/reindex.py') diff --git a/proposals/reindex.py b/proposals/reindex.py index c66ec24..1f52466 100755 --- a/proposals/reindex.py +++ b/proposals/reindex.py @@ -1,6 +1,11 @@ #!/usr/bin/env python -import re, os +# Future imports for Python 2.7, mandatory in 3.0 +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import codecs, re, os class Error(Exception): pass STATUSES = """DRAFT NEEDS-REVISION NEEDS-RESEARCH OPEN ACCEPTED META FINISHED @@ -23,7 +28,7 @@ def indexed(seq): def readProposal(fn): fields = { } - f = open(fn, 'r') + f = codecs.open(fn, 'r', encoding='utf-8') lastField = None try: for lineno, line in indexed(f): -- cgit v1.2.3-54-g00ecf