diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-08-16 11:50:25 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-08-19 12:52:26 -0700 |
commit | fa3dd1b04567c4ea03fa658c3838b569531c79f5 (patch) | |
tree | 6ffc0eedbf03b11ed87f92bd609bca6533ed64aa /alot/helper.py | |
parent | dee41bb04906d6976b4f7c05c222f7d95182b3ea (diff) |
Use io.BytesIO and io.StringIO
In python3 StringIO and cStringIO are gone. In their place are
io.BytesIO and io.StringIO. They are somewhat different in that they are
not separated on implementation, but on the type they emulated. BytesIO
works like the bytes class (str in python 2), while StringIO works like
the str class (unicode in python2).
Diffstat (limited to 'alot/helper.py')
-rw-r--r-- | alot/helper.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/alot/helper.py b/alot/helper.py index effec6b3..ce307875 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -9,7 +9,7 @@ from __future__ import division from datetime import timedelta from datetime import datetime from collections import deque -from cStringIO import StringIO +from io import BytesIO import logging import mimetypes import os @@ -315,8 +315,8 @@ def call_cmd_async(cmdlist, stdin=None, env=None): class _EverythingGetter(ProcessProtocol): def __init__(self, deferred): self.deferred = deferred - self.outBuf = StringIO() - self.errBuf = StringIO() + self.outBuf = BytesIO() + self.errBuf = BytesIO() self.outReceived = self.outBuf.write self.errReceived = self.errBuf.write @@ -606,7 +606,7 @@ def email_as_string(mail): :param mail: email to convert to string :rtype: str """ - fp = StringIO() + fp = BytesIO() g = Generator(fp, mangle_from_=False, maxheaderlen=78) g.flatten(mail) as_string = RFC3156_canonicalize(fp.getvalue()) |