Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import cups
import subprocess
import time
conn = cups.Connection ()
printid = conn.printFile('ML2580N-1', '/tmp/test.txt', 'test', {})
print printid
stop = 0
TIMEOUT = 10
while str(subprocess.check_output(["lpstat"])).find(str(printid)) != 0 and stop < TIMEOUT:
stop += 1
time.sleep(1)
print "In queue"
if str(subprocess.check_output(["lpstat"])).find(str(printid)) == 0:
print "Transmitted"
else:
print "PRINT FAILURE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment