我已经安装了pycups和打印机的驱动程序,可以连接它并在Libre Office中打印文档,但是我尝试在名为imprime1.py的文件中使用pycups进行连接,并且出现以下错误:
conn.printFile (p_name, file, "Project Report", {})
cups.IPPError: (1286, u'Destination "ML320-TURBO" is not accepting jobs.')
我的python代码是:
import cups
conn = cups.Connection()
p_name = "ML320-TURBO" # Printer Queue Name in CUPS
file_name = "/usr/share/cups/model/okdotmatrix9.ppd" # PPD file location
file = "~/Desktop/prueba.txt"
inf = "OKI DATA CORP ML320/1TURBO" # Description in CUPS
loc = "" # Location
uri_add = "usb://OKI%20DATA%20CORP/ML320/1TURBO" # URI of printer, use getDevices()
conn.addPrinter(name= p_name, filename= file_name, info = inf , location = loc, device = uri_add)
conn.printFile (p_name, file, "Project Report", {})
我在那儿弄错了吗?请帮我。 预先感谢。