Hi,
We are getting some errors when ERPNext trying to fetch emails from IMAP account.
The errors listed in Error Logs are the nexts:
email_account.receive
Traceback (most recent call last):
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py”, line 280, in receive
communication = self.insert_communication(msg, args=args)
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py”, line 337, in insert_communication
email = Email(raw)
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/receive.py”, line 372, in init
self.parse()
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/receive.py”, line 393, in parse
self.process_part(part)
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/receive.py”, line 445, in process_part
self.text_content += self.get_payload(part)
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/receive.py”, line 489, in get_payload
charset = self.get_charset(part)
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/receive.py”, line 484, in get_charset
charset = chardet.detect(cstr(part))[‘encoding’]
File “/home/frappe-user/frappe-bench/env/lib/python3.6/site-packages/chardet/init.py”, line 34, in detect
‘{0}’.format(type(byte_str)))
TypeError: Expected object of type bytes or bytearray, got: <class ‘str’>
pull_from_email_account
{‘e’: InternalError(1366, “Incorrect string value: ‘\xE1tico,…’ for column _1bd3e0294da19198
.tabUnhandled Email
.raw
at row 1”), ‘method_name’: ‘pull_from_email_account’, ‘log’: <function log at 0x7fea1c37f378>, ‘retry’: 0, ‘is_async’: True, ‘user’: ‘Administrator’, ‘kwargs’: {‘email_account’: ‘Oskar’}, ‘job_name’: ‘pull_from_email_account|Oskar’, ‘event’: ‘all’, ‘method’: <function pull_from_email_account at 0x7fea1c325ea0>, ‘site’: ‘erp.loonfy.com’}
Traceback (most recent call last):
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py”, line 280, in receive
communication = self.insert_communication(msg, args=args)
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py”, line 337, in insert_communication
email = Email(raw)
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/receive.py”, line 372, in init
self.parse()
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/receive.py”, line 393, in parse
self.process_part(part)
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/receive.py”, line 445, in process_part
self.text_content += self.get_payload(part)
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/receive.py”, line 489, in get_payload
charset = self.get_charset(part)
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/receive.py”, line 484, in get_charset
charset = chardet.detect(cstr(part))[‘encoding’]
File “/home/frappe-user/frappe-bench/env/lib/python3.6/site-packages/chardet/init.py”, line 34, in detect
‘{0}’.format(type(byte_str)))
TypeError: Expected object of type bytes or bytearray, got: <class ‘str’>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/utils/background_jobs.py”, line 99, in execute_job
method(**kwargs)
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py”, line 724, in pull_from_email_account
email_account.receive()
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py”, line 289, in receive
self.handle_bad_emails(email_server, uid, msg, frappe.get_traceback())
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py”, line 323, in handle_bad_emails
unhandled_email.insert(ignore_permissions=True)
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/model/document.py”, line 244, in insert
self.db_insert()
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/model/base_document.py”, line 324, in db_insert
), list(d.values()))
File “/home/frappe-user/frappe-bench/apps/frappe/frappe/database/database.py”, line 156, in sql
self._cursor.execute(query, values)
File “/home/frappe-user/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py”, line 170, in execute
result = self._query(query)
File “/home/frappe-user/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py”, line 328, in _query
conn.query(q)
File “/home/frappe-user/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/frappe-user/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 732, in _read_query_result
result.read()
File “/home/frappe-user/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 1075, in read
first_packet = self.connection._read_packet()
File “/home/frappe-user/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 684, in _read_packet
packet.check_error()
File “/home/frappe-user/frappe-bench/env/lib/python3.6/site-packages/pymysql/protocol.py”, line 220, in check_error
err.raise_mysql_exception(self._data)
File “/home/frappe-user/frappe-bench/env/lib/python3.6/site-packages/pymysql/err.py”, line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1366, “Incorrect string value: ‘\xE1tico,…’ for column _1bd3e0294da19198
.tabUnhandled Email
.raw
at row 1”)
Anyone have some suggest about?
Thanks for all.