[python-win32] Re: StartDoc failed

Luc Saffre luc.saffre at gmx.net
Tue Feb 22 12:34:36 CET 2005


On 22.02.2005 07:06, Roger Upole wrote:
> PRINTER_ENUM_DEFAULT only works on Windows 95/98.
> win32print.OpenPrinter(win32print.GetDefaultPrinter())
> should get a handle that you can pass to GetPrinter.

Roger,
thank you again for your reply. Your hints work, except that element 18 
doesn't seem to be the printer status. The whole information returned by 
GetPrinter() is always the same, no matter whether network unavailable, 
network available but printer off-line, or nw available and printer on-line.

Here is the code I am using to test:

   while True:
       h = win32print.OpenPrinter(win32print.GetDefaultPrinter())
       t = win32print.GetPrinter(h)
       win32print.ClosePrinter(h)

       if t[18]:
           break
       print t
       if not confirm("printer not ready. retry?"):
            raise PrinterNotReady

Here is the content of t:

('\\\\KYLLIKI', '\\\\KYLLIKI\\Samsung ML-1200 Series',
'ML-1200', 'LPT1:', 'Samsung ML-1200 Series',
'Samsung ML-1210/ML-1220M', '', None, '', 'WinPrint',
'RAW', '', None, 24, 1, 0, 0, 0, 0, 1, 0)

All this is very funny...
Luc


More information about the Python-win32 mailing list