diff options
author | teor <teor@torproject.org> | 2020-02-06 10:53:45 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2020-02-06 11:01:27 +1000 |
commit | ec92bbba5dbb9733f26c0f5887702ec73f76f566 (patch) | |
tree | e688593a410664cebf99ca8f496665cc52b05628 /proposals/reindex.py | |
parent | d897e4de4a224f165617761638f5b3f3e876c617 (diff) | |
download | torspec-ec92bbba5dbb9733f26c0f5887702ec73f76f566.tar.gz torspec-ec92bbba5dbb9733f26c0f5887702ec73f76f566.zip |
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.
Diffstat (limited to 'proposals/reindex.py')
-rwxr-xr-x | proposals/reindex.py | 9 |
1 files changed, 7 insertions, 2 deletions
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): |