diff --git a/pep2rss.py b/pep2rss.py index 0aa2a0923..71e2c413c 100755 --- a/pep2rss.py +++ b/pep2rss.py @@ -1,16 +1,15 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # usage: pep-hook.py $REPOS $REV # (standard post-commit args) import os, glob, time, datetime, stat, re, sys -import codecs import PyRSS2Gen as rssgen RSS_PATH = os.path.join(sys.argv[1], 'peps.rss') def firstline_startingwith(full_path, text): - for line in codecs.open(full_path, encoding="utf-8"): + for line in open(full_path, encoding="utf-8"): if line.startswith(text): return line[len(text):].strip() return None @@ -71,5 +70,5 @@ rss = rssgen.RSS2( lastBuildDate = datetime.datetime.now(), items = items) -with open(RSS_PATH, 'w') as fp: - fp.write(rss.to_xml()) +with open(RSS_PATH, 'w', encoding="utf-8") as fp: + fp.write(rss.to_xml(encoding="utf-8"))