[python-win32] Adding Printers on Windows XP

Brad Tilley rtilley at vt.edu
Thu Dec 22 20:24:45 CET 2005


When I do this:

import win32print
printers = ['http://128.173.120.65']
for printer in printers:
     pHandle = win32print.OpenPrinter(printer, None)
    #print pHandle

    pInfo = win32print.GetPrinter(pHandle, 2)
    #print pInfo

    win32print.ClosePrinter(pHandle)

    pAdd = win32print.AddPrinter(None, 2, pInfo)

I get this error:

Traceback (most recent call last):
  File "C:\Documents and Settings\Administrator\Desktop\printers.py", 
line 15, in ?
    pAdd = win32print.AddPrinter(None, 2, pInfo)
ValueError: PyDEVMODE cannot be None in this context

Any ideas?



More information about the Python-win32 mailing list