Cannot Print PDF Anymore

Hi,

As the letterhead did not show up in the pdf print, even though the “Letterhead” box was checked, I thought updating to a newer version of ERPNext might help.

However, after updating to the latest version using the

bench update

command (I installed the VirtualBox image of ERPNext), I cannot print any files to pdf anymore:

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%
[=========>                                                  ] 16%
Warning: Failed to load http://erpnext.erpnext-vm/assets/frappe/css/bootstrap.css (ignore)
Warning: Failed to load http://erpnext.erpnext-vm/files/sovonex.png (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

Do you have an idea what might have gone wrong here?

Cheers,

Stefan

Have you setup the vm yourself or is it the one we provided?

I used the one provided on your download page.

Run the following commands to fix this,

bench update --bench
bench set-url-root erpnext.erpnext-vm http://localhost:8080

I ran the following commands:

cd frappe-bench
bench update --bench
bench set-url-root erpnext.erpnext-vm http://localhost:8080

The last command returned an error:

No such command "set-url-root"

what is the output of pip freeze?

Sorry, I don’t know how to select text from the terminal window in VirtualBox. Is there anything you need to know in particular?

I suspect that your bench is not installed as editable. Try running

pip uninstall bench
pip install -e /home/erpnext/bench-repo

as root and try again

When running

sudo pip uninstall bench

and entering the password, I got the following error message:

Sorry, user erpnext is not allowed to execute '/usr/local/bin/pip uninstall bench' as root on erpnext-vm.erpnext-vm.

Also, I previously added the Dropbox credentials to the config file, so I guess bench is editable (at least before the update). Or does this have nothing to do with it?

su # enter root password (erpnext for VM from our site)
pip uninstall bench
pip install -e /home/erpnext/bench-repo
exit

after typing

pip uninstall bench 

I got this error message:

Can't uninstall 'bench'. No files were found to uninstall.

What is the output of

head -n1 `which bench`

The output of

head -n1 `which bench` 

was

#!/usr/bin/python2.7

Great, so we confirm that it’s installed for Python2.7. Now, does,
pip2.7 uninstall bench uninstall it?

I ran the following commands:

su
<password>
pip2.7 uninstall bench

This is the error message I received:

Cant uninstal 'bench'. No files were found to uninstall.

Is there anything else I might try?

Maybe just

su
pip2.7 install -e /home/frappe/bench-repo
exit

and then

cd frappe-bench
bench set-url-root erpnext.erpnext-vm http://localhost:8080

Thanks,

Pratik
ERPNext

su
pip2.7 install -e /home/frappe/bench-repo

returned the following error message:

/home/frappe/bench-repo should either be a path to a local project or a VCS url beginning with svn+, git+, hg+, or bzr+
Storing debug log for failure in /root/.pip/pip.log

Sorry, it should be /home/erpnext/bench-repo

The command

su
pip2.7 install -e /home/erpnext/bench-repo

went fine, but the following command

bench set-url-root erpnext.erpnext-vm http://localhost:8080

returned this error message:

Error: No such command "set-url-root".