我得到了错误pywintypes.error: (1801, 'AddPrinter', 'The printer name is invalid.')
我的目的是添加一个网络打印机到终端用户计算机。。。这是我的定义
^{pr2}$
这是怎么回事。。。它必须是一个有效的打印机名,因为它成功地拉动了句柄,并给了我它想要的pInfo dict。。。令人沮丧的。。。我不想做任何批处理文件!!在
谢谢你的帮助。在
回溯:\\cheops1\4EPrint1 = <4704604>4704604>
{'Status': 0, 'UntilTime': 0, 'pDriverName': 'HP Universal Printing PCL 5 (v5.0)', 'cJobs': 0, 'pSepFile': '', 'AveragePPM': 0, 'pPortName': 'IP_10.10.185.5', 'pParameters': '', 'pPrintProcessor': 'hpcpp091', 'Attributes': 8728, 'Priority': 1, 'pPrinterName': '\\\\cheops1\\4EPRINT1', 'DefaultPriority': 0, 'StartTime': 0, 'pDatatype': 'RAW', 'pDevMode': , 'pLocation': '10.10.185.5', 'pShareName': '4EPRINT1', 'pServerName': '\\\\cheops1', 'pSecurityDescriptor': , 'pComment': 'Rm 4053, 4E Main Desk Laser, Laserjet 4100 MFP, LNWID - 711096'}
Traceback (most recent call last):
File "D:\workspace\Clinical Applications\EPIC\EPIC_Values.py", line 183, in
AddPrinter(computer, printer)
File "D:\workspace\Clinical Applications\EPIC\EPIC_Values.py", line 161, in AddPrinter
win32print.AddPrinter(computer, 2, pInfo)
pywintypes.error: (1801, 'AddPrinter', 'The printer name is invalid.')