IMAP pull_from_email_account

I just recently setup a new development ERPNext instance for a client and I’m running into an IMAP issue…

Error
{'retry': 0, 'async': True, 'log': <function log at 0x7f98ebb77268>, 'user': 'Administrator', 'event': 'all', 'kwargs': {'email_account': 'Sales'}, 'method_name': 'pull_from_email_account', 'method': <function pull_from_email_account at 0x7f98ebb06400>, 'site': 'portal.somedomain.com', 'job_name': 'pull_from_email_account|Sales'}
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 116, in get_messages
    uid_list = email_list = self.get_new_mails()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 176, in get_new_mails
    self.check_imap_uidvalidity()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 194, in check_imap_uidvalidity
    current_uid_validity = self.parse_imap_responce("UIDVALIDITY", message[0])
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 228, in parse_imap_responce
    match = re.search(pattern, responce, re.U | re.I)
  File "/home/frappe/frappe-bench/env/lib/python3.5/re.py", line 173, in search
    return _compile(pattern, flags).search(string)
**TypeError: cannot use a string pattern on a bytes-like object**

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 98, in execute_job
    method(**kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 712, in pull_from_email_account
    email_account.receive()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 260, in receive
    emails = email_server.get_messages()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 149, in get_messages
    if self.has_login_limit_exceeded(e):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 295, in has_login_limit_exceeded
    return "-ERR Exceeded the login limit" in strip(cstr(e.message))
AttributeError: 'TypeError' object has no attribute 'message'

I see the exceed login limit in the last error but I believe there is an issue with just parsing the inbox itself and finding messages.

I’m running the latest development (v11).

Let me know if you have any ideas.

Update: I’ve found the following information when searching online for similar issues (non-erpnext)…

And fixed

1 Like