♻ codecs.open -> io.open

The general consensus regarding codecs.open appears to be that it's only
left in Python 3 for backwards compatibility (which I find kind funny
but I digress...) and that io.open should be used instead for Py2.6+
since it's available and behaving the same in both versions. So that's
what we do here.
This commit is contained in:
Gina Häußge committed 2019-02-06 16:05:09 +01:00
1 parent 09cc7cf5f7
commit 32a8646135
7 files changed
+37 -24

No files matched your search

@@ -195,8 +195,8 @@ def _rescue_changes(git_executable, folder):
if returncode is None or returncode != 0:
raise RuntimeError("Could not update, installation directory was dirty and state could not be persisted as a patch to {}".format(patch))
import codecs
with codecs.open(patch, "w", encoding="utf-8", errors="replace") as f:
import io
with io.open(patch, "wt", encoding="utf-8", errors="replace") as f:
for line in stdout:
f.write(line)