[python-win32] Re: Adding Printers on Windows XP
Roger Upole
rwupole at msn.com
Sun Dec 25 07:36:14 CET 2005
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" <rtilley at vt.edu>
To: <python-win32 at 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?
>
>
>
More information about the Python-win32
mailing list