I am getting the following error while trying to download a PDF using the demo virtual machine :
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 109, 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%
[=============> ] 23%
Warning: Failed to load http://erpnext.erpnext-vm/assets/frappe/css/bootstrap.css (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: HostNotFoundError
What I did before :
Imported the Demo Virtual Machine in Virtual Box.
Updated using “Bench Update”.
Did the Initial Company Setup
Created a Dummy Sales Invoice then tried to download the PDF
any thoughts ?
regards
Akshay
P.S. Using the ERPNext Demo VM created on 15th Sept.
I edited file at /sites/erpnext.erpnext-vm/site_config.json added the line as suggestted. But now I am getting the following error :
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 109, 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%
[=============> ] 23%
Warning: Failed to load file:///tmp/localhost/assets/frappe/css/bootstrap.css (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: ContentNotFoundError
I tried to replicate this. Although it did not give me an error, the style sheet was missing. Can you change the host_name to “localhost:8080” and try?
had the same problem. It was somehow related to the network config.
Please check also:
/etc/network/interfaces
Maybe there is a conflict with the host-machine as well. I first had “bridged” mode as it seemed to be the best solution. But then I changed to NAT and give it a different IP…that solved the problems for me.
Was this resolved? I’m getting the same error ‘ContentNotFoundError’ on Digital Ocean while downloading PDF files. Standard production install procedure, developer mode is off.
I’m using v5 on aws-ec2 and got this error when trying to download PDF:
Traceback (innermost last):
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py”, line 54, in application
response = frappe.api.handle()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/api.py”, line 50, in handle
return frappe.handler.handle()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/handler.py”, line 62, in handle
execute_cmd(cmd)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/handler.py”, line 85, in execute_cmd
ret = frappe.call(method, **frappe.form_dict)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 734, in call
return fn(*args, **newargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/templates/pages/print.py”, line 115, in download_pdf
frappe.local.response.filecontent = get_pdf(html)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/pdf.py”, line 30, in get_pdf
pdfkit.from_string(html, fname, options=options or {})
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/api.py”, line 66, in from_string
configuration=configuration)
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/pdfkit.py”, line 38, in init
self.configuration = (Configuration() if configuration is None
File “/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/pdfkit/configuration.py”, line 18, in init
[‘which’, ‘wkhtmltopdf’], stdout=subprocess.PIPE).communicate()[0].strip()
File “/usr/lib/python2.7/subprocess.py”, line 710, in init
errread, errwrite)
File “/usr/lib/python2.7/subprocess.py”, line 1223, in _execute_child
self.pid = os.fork()
OSError: [Errno 12] Cannot allocate memory