Dear colleagues,
I have the following error in an ERPNext V12 instance: when trying to send an email from a document (e.g. supplier quotation) with the document print attached, the following error is returned:
'OSError' object has no attribute 'message'
Traceback (most recent call last):
File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/pdfkit/configuration.py", line 21, in __init__
with open(self.wkhtmltopdf) as f:
FileNotFoundError: [Errno 2] No such file or directory: b''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/pdf.py", line 25, in get_pdf
filedata = pdfkit.from_string(html, False, options=options or {})
File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/pdfkit/api.py", line 70, in from_string
configuration=configuration, cover_first=cover_first)
File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/pdfkit/pdfkit.py", line 42, in __init__
self.configuration = (Configuration() if configuration is None
File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/pdfkit/configuration.py", line 27, in __init__
'https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf' % self.wkhtmltopdf)
OSError: No wkhtmltopdf executable found: "b''"
If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/queue.py", line 404, in send_one
message = prepare_message(email, recipient.recipient, recipients_list)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/queue.py", line 536, in prepare_message
print_format_file = frappe.attach_print(**attachment)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1391, in attach_print
"fcontent": get_print(doctype, name, print_format=print_format, style=style, html=html, as_pdf=True, doc=doc, no_letterhead=no_letterhead, password=password)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1368, in get_print
return get_pdf(html, output = output, options = options)
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/pdf.py", line 32, in get_pdf
if ("ContentNotFoundError" in e.message
AttributeError: 'OSError' object has no attribute 'message'
The email can be sent without the attachement without any issue. Also, the PDF renders without any issues from the print preview > PDF. And, if the mail is sent manually from the Email Queue using the send button while it is “not sent”, it works as well.
Any ideas what could go wrong?