Error in using frappe.sendmail function


When i using frappe.sendmail in my .py I got error shows below

Traceback (most recent call last):
  File "apps/frappe/frappe/", line 68, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/", line 31, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/", line 68, in execute_cmd
    return, **frappe.form_dict)
  File "apps/frappe/frappe/", line 1208, in call
    return fn(*args, **newargs)
  File "apps/companyerp/companyerp/", line 148, in sal_dn_mail
  File "apps/frappe/frappe/", line 555, in sendmail
    inline_images=inline_images, header=header, print_letterhead=print_letterhead, with_container=with_container)
  File "apps/frappe/frappe/email/", line 162, in send
  File "apps/frappe/frappe/email/", line 183, in add
    email_queue = get_email_queue(recipients, sender, subject, **kwargs)
  File "apps/frappe/frappe/email/", line 227, in get_email_queue
    e.message = cstr(mail.as_string())
  File "apps/frappe/frappe/email/", line 254, in as_string
  File "apps/frappe/frappe/email/", line 187, in validate
    self.recipients = [strip(r) for r in self.recipients]
  File "apps/frappe/frappe/email/", line 187, in <listcomp>
    self.recipients = [strip(r) for r in self.recipients]
  File "apps/frappe/frappe/email/", line 71, in <genexpr>
    recipients = filter(None, (strip(r) for r in recipients))
  File "apps/frappe/frappe/utils/", line 1489, in strip
    return (val or "").replace("\ufeff", "").replace("\u200b", "").strip(chars)
AttributeError: 'tuple' object has no attribute 'replace'

Sounds like the array recipients which I send to function sendmail has issues.
This is what i did

        rec_doc=frappe.db.get_list('Has Role',filters={'Role': ['=','Stock User'],'parenttype':['=','User']},fields=['parent'])
        for row in rec_doc:

Please let me know how to fix it.

Thanks a lot.

The issue is gone after the whole system rebooted.
I don’t know why, maybe because some cache was cleaned ?