A null DEVMODE usually indicates a problem with the printer driver. Are you sure you have the correct driver installed on the local machine ? Also, what do you get back from GetPrinter for DriverName ? A couple of things you could try: Use win32print.DocumentProperties to retreive the printer's DEVMODE Create one yourself using pywintypes.DEVMODEType() and insert it into the pInfo dict
hth Roger ----- Original Message ----- From: "Brad Tilley" <[EMAIL PROTECTED]> To: <python-win32@python.org> Sent: Thursday, December 22, 2005 2:24 PM Subject: [python-win32] Adding Printers on Windows XP > 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? > > > _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32