diff --git a/mode/mbox.py b/mode/mbox.py index 6ca8a4e..0bec37d 100644 --- a/mode/mbox.py +++ b/mode/mbox.py @@ -1,4 +1,4 @@ -import commands, dirutil, grp, mailbox, method, mode, os.path, pwd, re +import commands, dirutil, grp, mailbox, method, mode, os.path, pwd, re, sys import buffer, default, window from mode.mutt import MuttGrammar from lex import Grammar, PatternRule, RegionRule, PatternGroupRule @@ -134,7 +134,11 @@ class MboxListBuffer(Buffer): f = open(self.path, 'r') self.size = len(f.read()) f.close() - self.mbox = mailbox.mbox(self.path) + if sys.version_info == 4: + fp = open(self.path, 'rb') + self.mbox = mailbox.UnixMailbox(fp) + else: + self.mbox = mailbox.mbox(self.path) lines = [] pos = 1 msgs = list(self.mbox)