You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use Flask==0.10.1 and Flask-Mail==0.9.1 with python 3.5.1, to send email as above code . I found it will fail when attachment filename is long, as I comment fail. error log is below, I am not sure is bug of flask mail or python3.5.1, after google can't find how to fix this.
Traceback (most recent call last):
File "manage.py", line 31, in
manager.run()
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_script/init.py", line 412, in run
result = self.handle(sys.argv[0], sys.argv[1:])
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_script/init.py", line 383, in handle
res = handle(*args, **config)
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_script/commands.py", line 216, in call
return self.run(*args, **kwargs)
File "/Users/brad/work/ZS-wecaht-web/app/commands/dev.py", line 281, in send_customized_qrcode_subscribe_daily_report
customized_qrcode_subscribe_daily_report(store_id)
File "/Users/brad/work/ZS-wecaht-web/app/reports.py", line 24, in customized_qrcode_subscribe_daily_report
report.send_mail()
File "/Users/brad/work/ZS-wecaht-web/app/reports.py", line 127, in send_mail
mail.send(msg)
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_mail.py", line 492, in send
message.send(connection)
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_mail.py", line 427, in send
connection.send(self)
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_mail.py", line 190, in send
message.as_bytes() if PY3 else message.as_string(),
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_mail.py", line 385, in as_bytes
return self._message().as_bytes()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/message.py", line 179, in as_bytes
g.flatten(self, unixfrom=unixfrom)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 115, in flatten
self._write(msg)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 181, in _write
self._dispatch(msg)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 214, in _dispatch
meth(msg)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 272, in _handle_multipart
g.flatten(part, unixfrom=False, linesep=self._NL)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 115, in flatten
self._write(msg)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 195, in _write
self._write_headers(msg)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 422, in _write_headers
self._fp.write(self.policy.fold_binary(h, v))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/policy.py", line 192, in fold_binary
return folded.encode(charset, 'surrogateescape')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 42-51: ordinal not in range(128)
The text was updated successfully, but these errors were encountered:
I use Flask==0.10.1 and Flask-Mail==0.9.1 with python 3.5.1, to send email as above code . I found it will fail when attachment filename is long, as I comment fail. error log is below, I am not sure is bug of flask mail or python3.5.1, after google can't find how to fix this.
Traceback (most recent call last):
File "manage.py", line 31, in
manager.run()
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_script/init.py", line 412, in run
result = self.handle(sys.argv[0], sys.argv[1:])
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_script/init.py", line 383, in handle
res = handle(*args, **config)
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_script/commands.py", line 216, in call
return self.run(*args, **kwargs)
File "/Users/brad/work/ZS-wecaht-web/app/commands/dev.py", line 281, in send_customized_qrcode_subscribe_daily_report
customized_qrcode_subscribe_daily_report(store_id)
File "/Users/brad/work/ZS-wecaht-web/app/reports.py", line 24, in customized_qrcode_subscribe_daily_report
report.send_mail()
File "/Users/brad/work/ZS-wecaht-web/app/reports.py", line 127, in send_mail
mail.send(msg)
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_mail.py", line 492, in send
message.send(connection)
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_mail.py", line 427, in send
connection.send(self)
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_mail.py", line 190, in send
message.as_bytes() if PY3 else message.as_string(),
File "/Users/brad/work/ZS-wecaht-web/venv/lib/python3.5/site-packages/flask_mail.py", line 385, in as_bytes
return self._message().as_bytes()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/message.py", line 179, in as_bytes
g.flatten(self, unixfrom=unixfrom)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 115, in flatten
self._write(msg)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 181, in _write
self._dispatch(msg)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 214, in _dispatch
meth(msg)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 272, in _handle_multipart
g.flatten(part, unixfrom=False, linesep=self._NL)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 115, in flatten
self._write(msg)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 195, in _write
self._write_headers(msg)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/generator.py", line 422, in _write_headers
self._fp.write(self.policy.fold_binary(h, v))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/email/policy.py", line 192, in fold_binary
return folded.encode(charset, 'surrogateescape')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 42-51: ordinal not in range(128)
The text was updated successfully, but these errors were encountered: