[python-win32] Raise exception for printers
Schoeni, Yann
Yann.Schoeni at moutier.ch
Wed May 2 11:32:01 EDT 2018
Hey guys,
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.
Here is a sample of my code
job = win32print.OpenPrinter(printer_name)
printer_info = win32print.GetPrinter(job, 2)
for key, value in printer_info.items() :
print (key, value)
return value :
pServerName None
pPrinterName DTC1250e Card Printer
pShareName DTC1250
pPortName USB001
pDriverName DTC1250e Card Printer
pComment
pLocation
pDevMode <PyDEVMODEW object at 0x01BF4E08>
pSepFile
pPrintProcessor winprint
pDatatype RAW
pParameters
pSecurityDescriptor <PySECURITY_DESCRIPTOR object at 0x057A9648>
Attributes 11848
Priority 1
DefaultPriority 0
StartTime 1380
UntilTime 1380
Status 0
cJobs 18
AveragePPM 0
If someone has an idea, it would be nice.
Is there a solution to check if the ink or paper runs out ?
Thank you guys !
Meilleures salutations
Yann Schoeni
Municipalité de Moutier
Apprenti informaticien
Tél. +41 (0)32 494 11 69
Mob. +41 (0)79 827 30 86
E-mail yann.schoeni at moutier.ch<mailto:yann.schoeni at moutier.ch>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20180502/78950e57/attachment.html>
More information about the python-win32
mailing list