catching sys.stderr.write error when image is sent and printer is not connected
This commit is contained in:
parent
73b0f9310f
commit
4069170f3a
@ -9,7 +9,7 @@ import io
|
|||||||
def connect():
|
def connect():
|
||||||
# Get the printer's USB initializing code with $ sudo lsbusb
|
# Get the printer's USB initializing code with $ sudo lsbusb
|
||||||
try:
|
try:
|
||||||
lp = printer.Usb(0x4b8,0xe15) # televex printer @ Varia
|
# lp = printer.Usb(0x4b8,0xe15) # televex printer @ Varia
|
||||||
lp = printer.Usb(0x4b8,0xe03) # printer @ poel
|
lp = printer.Usb(0x4b8,0xe03) # printer @ poel
|
||||||
except:
|
except:
|
||||||
lp = None
|
lp = None
|
||||||
@ -113,5 +113,4 @@ def print_now(output, lp=None, type=None):
|
|||||||
lp.image(output)
|
lp.image(output)
|
||||||
lp.cut()
|
lp.cut()
|
||||||
else:
|
else:
|
||||||
sys.stderr.write('Printing output to the terminal:\n\n'+output+'\n\n')
|
sys.stderr.write('Printing output to the terminal:\n\n'+str(output)+'\n\n')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user