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…

{'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': '', 'job_name': 'pull_from_email_account|Sales'}
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/", line 116, in get_messages
    uid_list = email_list = self.get_new_mails()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/", line 176, in get_new_mails
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/", 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/", line 228, in parse_imap_responce
    match =, responce, re.U | re.I)
  File "/home/frappe/frappe-bench/env/lib/python3.5/", 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/", line 98, in execute_job
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/", line 712, in pull_from_email_account
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/", line 260, in receive
    emails = email_server.get_messages()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/", line 149, in get_messages
    if self.has_login_limit_exceeded(e):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/", 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