PDF Generation error

Hi,

i just got this error in web console

"Traceback (innermost last):
File “/home/sigma/frappe-bench/apps/frappe/frappe/core/doctype/communication/communication.py”, line 154, in attach_print
mail.add_pdf_attachment(name.replace(’ ‘,’‘).replace(’/‘,’-') + ‘.pdf’, print_html)
File “/home/sigma/frappe-bench/apps/frappe/frappe/utils/email_lib/email_body.py”, line 157, in add_pdf_attachment
self.add_attachment(name, get_pdf(html, options), ‘application/octet-stream’)
File “/home/sigma/frappe-bench/apps/frappe/frappe/utils/pdf.py”, line 28, in get_pdf
pdfkit.from_string(html, fname, options=options or {})
File “/home/sigma/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/api.py”, line 68, in from_string
return r.to_pdf(output_path)
File “/home/sigma/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/pdfkit.py”, line 131, in to_pdf
’ '.join(args))
IOError: Command failed: /usr/bin/wkhtmltopdf --margin-top 15mm --margin-right 15mm --page-size A4 --encoding UTF-8 --background --print-media-type --images --margin-left 15mm --no-outline --margin-bottom 15mm - /tmp/bb2d74463f61bb9c8890b7dde0161ca1edf046c201a0a3faee6030dd.pdf
Check whhtmltopdf output without ‘quiet’ option
"

this shown as i want to send mail as PDF, and the message said that PDF Generating error and mail send as HTML
how can i fix this ?

You will have to check why this specific print has failed. Run it from the command line to see the trace.

Error here too:

Traceback (innermost last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/app.py”, line 52, in application
response = frappe.api.handle()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/api.py”, line 42, in handle
return frappe.handler.handle()
File “/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py”, line 66, in handle
execute_cmd(cmd)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py”, line 89, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/init.py”, line 531, in call
return fn(*args, **newargs)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/templates/pages/print.py”, line 94, in download_pdf
frappe.local.response.filecontent = get_pdf(html)
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/pdf.py”, line 28, in get_pdf
pdfkit.from_string(html, fname, options=options or {})
File “/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/api.py”, line 68, in from_string
return r.to_pdf(output_path)
File “/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/pdfkit.py”, line 116, in to_pdf
raise IOError(‘wkhtmltopdf reported an error:\n’ + stderr.decode(‘utf-8’))
IOError: wkhtmltopdf reported an error:
Loading pages (1/6)
[> ] 0%
[======> ] 10%
[=========> ] 16%
Warning: Failed to load http://abcd.com/assets/frappe/css/bootstrap.css (ignore)
Warning: Failed to load http://abcd.com/files/HeerLogo_801_v-2-0.gif (ignore)
Warning: Failed to load http://abcd.com/files/L-StutzeRechts_001.jpg (ignore)
[============================================================] 100%
Counting pages (2/6)
[============================================================] Object 1 of 1
Warning: Received createRequest signal on a disposed ResourceObject’s NetworkAccessManager. This migth be an indication of an iframe taking to long to load.
Warning: Received createRequest signal on a disposed ResourceObject’s NetworkAccessManager. This migth be an indication of an iframe taking to long to load.
Resolving links (4/6)
[============================================================] Object 1 of 1
Loading headers and footers (5/6)
Printing pages (6/6)
[> ] Preparing
[==============================> ] Page 1 of 2
[============================================================] Page 2 of 2
Done
Exit with code 1 due to network error: ConnectionRefusedError

solved it with:
bench set-url-root {sitename} http://{hostname_that_resolves_the_site}

Example
bench set-url-root site1.local https://my.site.com