From 52517c8ca62dbf1e292de07acd6f3d9f43ba6f6a Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Wed, 13 Apr 2016 17:56:03 +0200 Subject: [PATCH] Open CSV files in binary mode on Python 2. Closes GH-1230. --- plugins/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/__init__.py b/plugins/__init__.py index 5796de465..51e491eb9 100644 --- a/plugins/__init__.py +++ b/plugins/__init__.py @@ -251,7 +251,8 @@ class ChannelUserDB(ChannelUserDictionary): log.debug('Exception: %s', utils.exnToString(e)) def flush(self): - fd = utils.file.AtomicFile(self.filename, makeBackupIfSmaller=False) + mode = 'wb' if utils.minisix.PY2 else 'w' + fd = utils.file.AtomicFile(self.filename, mode, makeBackupIfSmaller=False) writer = csv.writer(fd) items = list(self.items()) if not items: