Closed zhengxiaowai closed 7 years ago
Hi Pascal van Kooten, your yagmail is awesome.
But, i send email by python2 and i insert from __future__ import unicode_literals to my file. now all string is unicode.
from __future__ import unicode_literals
yagmail use isinstance(some_var, str) in many place, just like:
isinstance(some_var, str)
https://github.com/kootenpv/yagmail/blob/master/yagmail/yagmail.py#L318
str and unicode are difference in python2, so that will raise error or pass something.
str
unicode
i guess this "str" is a text_type, such as six.text_type. so i replace isinstance(some_var, str) to isinstance(some_var, text_type)
six.text_type
isinstance(some_var, text_type)
yagmail not ues third party library, i simulate six.text_type to create a text_type:
text_type
PY3 = sys.version_info[0] == 3 text_type = (str,) if PY3 else (str, unicode)
tests is ok in py2 or py3
Very professional Pull Request, thank you a lot!!!
You can see your new version from yagmail-0.6.161. To upgrade: pip install -U --no-cache yagmail
yagmail-0.6.161
pip install -U --no-cache yagmail
Hi Pascal van Kooten, your yagmail is awesome.
But, i send email by python2 and i insert
from __future__ import unicode_literals
to my file. now all string is unicode.yagmail use
isinstance(some_var, str)
in many place, just like:str
andunicode
are difference in python2, so that will raise error or pass something.i guess this "str" is a text_type, such as
six.text_type
. so i replaceisinstance(some_var, str)
toisinstance(some_var, text_type)
yagmail not ues third party library, i simulate
six.text_type
to create atext_type
:tests is ok in py2 or py3