Python 2.7 backward compat

This commit is contained in:
Yacine Filali
2017-05-23 16:10:13 -07:00
parent 086f5ba43b
commit dd0a0f5c4d
5 changed files with 52 additions and 32 deletions

View File

@@ -2,7 +2,8 @@
from __future__ import absolute_import
import regex as re
# noinspection PyUnresolvedReferences
import re
from talon import quotations, utils as u
from . import *
@@ -302,7 +303,12 @@ Reply
def extract_reply_and_check(filename):
f = open(filename, encoding='utf8')
import sys
kwargs = {}
if sys.version_info > (3, 0):
kwargs["encoding"] = "bytes"
f = open(filename, **kwargs)
msg_body = f.read()
reply = quotations.extract_from_html(msg_body)