Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cups
- import subprocess
- import time
- conn = cups.Connection ()
- printid = conn.printFile('ML2580N-1', '/tmp/test.txt', 'test', {})
- print printid
- stop = 0
- TIMEOUT = 20
- while str(subprocess.check_output(["lpstat"])).find(str(printid)) != -1 and stop < TIMEOUT:
- print "In queue"
- stop += 1
- time.sleep(1)
- if str(subprocess.check_output(["lpstat"])).find(str(printid)) == -1:
- print "Transmitted"
- else:
- print "PRINT FAILURE"
- conn.cancelJob(printid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement