I am having a printing error on quotation

Hi, I seem to be having a problem with printing a quotation. This is the error I get:
UnboundLocalError: local variable ‘file’ referenced before assignment

I have installed Pycups, the printer is listed in the print settings.
What seems to be the issue here with that error?

Some advice and help will be appreciated.

hi @Amrit_Kaur

please specify which version of bench and ErpNext are you using and the full error log.

Installed Apps

ERPNext: v12.11.2 (version-12)

Frappe Framework: v12.9.1 (version-12)

And the attachment below is the error I get when I click print.

Any advice?


Can you open your browser console and share the error traceback?

I having this exact issue . This is my browser console error
Traceback (most recent call last):
File “/home/erpnext/frappe-bench/apps/frappe/frappe/utils/print_format.py”, line 113, in print_by_server
conn = cups.Connection()
RuntimeError: failed to connect to server

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/app.py", line 64, in application
    response = frappe.api.handle()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/api.py", line 59, in handle
    return frappe.handler.handle()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py", line 24, in handle
    data = execute_cmd(cmd)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/handler.py", line 63, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 1054, in call
    return fn(*args, **newargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/print_format.py", line 128, in print_by_server