[python-win32] Raise exception for printers
Tim Roberts
timr at probo.com
Wed May 2 13:29:10 EDT 2018
Schoeni, Yann wrote:
>
>
> I’m trying to get error informations from my printer.
>
>
>
> The job is sending from a web application, the application use the php
> function « Shell_exec » to call the python CLI and passe the arguments
> to the python script.
>
>
>
> Anyway, I first tried to raise an exception if the printer isn’t turn
> on, but it’s harder than I thought, is there an easy way to do it ?
>
>
>
> I tried to do it by using the command « GetPrinter » but nothing seems
> to point the power state of the printer.
>
The "Status" value tells you some of that information. The bits are
defined here:
https://msdn.microsoft.com/en-us/library/cc244854.aspx
Power state is a tricky thing for the system to handle. The spooler
wants to allow you to submit print jobs even if the printer is off or
offline, because it will probably come back at some point. I suspect
you will find PRINTER_STATUS_SERVER_OFFLINE in that case.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list