192 | | # Get the page counter directly from the printer itself |
193 | | # Tries MAXTRIES times, sleeping two seconds each time, in case the printer is sleeping. |
194 | | # This was seen with my Apple LaserWriter 16/600 PS which doesn't answer before having warmed up. |
195 | | for i in range(MAXTRIES) : |
196 | | try : |
197 | | counterbeforejob = kotafilter.requester.getPrinterPageCounter(kotafilter.printerhostname) |
198 | | except PyKotaRequesterError, msg : |
199 | | # can't get actual page counter, assume printer is off or warming up |
200 | | # log the message anyway. |
201 | | kotafilter.logger.log_message("%s" % msg, "warn") |
202 | | counterbeforejob = None |
203 | | printerIsOff = 1 |
204 | | else : |
205 | | # printer answered, it is on so we can exit the loop |
206 | | printerIsOff = 0 |
207 | | break |
208 | | time.sleep(TIMETOSLEEP) |
209 | | |
| 218 | # Get the page counter directly from the printer itself |
| 219 | # Tries MAXTRIES times, sleeping two seconds each time, in case the printer is sleeping. |
| 220 | # This was seen with my Apple LaserWriter 16/600 PS which doesn't answer before having warmed up. |
| 221 | for i in range(MAXTRIES) : |
| 222 | try : |
| 223 | counterbeforejob = kotafilter.requester.getPrinterPageCounter(kotafilter.printerhostname) |
| 224 | except PyKotaRequesterError, msg : |
| 225 | # can't get actual page counter, assume printer is off or warming up |
| 226 | # log the message anyway. |
| 227 | kotafilter.logger.log_message("%s" % msg, "warn") |
| 228 | counterbeforejob = None |
| 229 | printerIsOff = 1 |
| 230 | else : |
| 231 | # printer answered, it is on so we can exit the loop |
| 232 | printerIsOff = 0 |
| 233 | break |
| 234 | time.sleep(TIMETOSLEEP) |
| 235 | |