Closed rec0de closed 6 years ago
Thanks @rec0de for the bug report. Was this a rather long printout? In that case, issue #48 and pull request #49 (just merged) could have fixed this. Please try again with the latest version here on Github, which can be installed that way:
pip install --upgrade https://github.com/pklaus/brother_ql/archive/master.zip
The printout was about square-ish on a 62mm roll - I'm not sure if that qualifies as a long printout, but the printer did take a while so I guess a timeout issue is reasonable. I can't replicate that exact print size right now, but the issue seems to have disappeared in the new version. Thanks a lot!
@rec0de > Update: I got it to work by using file:///dev/usb/lp0 as the printer URI instead of usb://0x04f9:0x2042 with pyusb backend.
Are you using macOS? I'm having a similar issue via pyusb. how did you get that file:///
printer address?
import brother_ql
from brother_ql.raster import BrotherQLRaster
from brother_ql.backends.helpers import send
# Using USB connected printer
PRINTER_IDENTIFIER = 'usb://0x04f9:0x209b'
printer = BrotherQLRaster('QL-800')
def send_to_printer(path):
print_data = brother_ql.brother_ql_create.convert(printer, [path], '62', dither=True)
send(print_data, PRINTER_IDENTIFIER)
my issue:
Need to resize the image...
Traceback (most recent call last):
File "stickers.py", line 354, in <module>
Main()
File "stickers.py", line 54, in __init__
printfolder.start(args)
File "stickers.py", line 254, in start
self._printfolder_images(sorted_array, int(args.sticker_count), args.sticker_size)
File "stickers.py", line 275, in _printfolder_images
send_to_printer(random_sticker["filepath"])
File "stickers.py", line 141, in send_to_printer
send(print_data, PRINTER_IDENTIFIER)
File "/Users/michael/bin/mypyenv/lib/python3.8/site-packages/brother_ql/backends/helpers.py", line 61, in send
printer.write(instructions)
File "/Users/michael/bin/mypyenv/lib/python3.8/site-packages/brother_ql/backends/generic.py", line 32, in write
self._write(data)
File "/Users/michael/bin/mypyenv/lib/python3.8/site-packages/brother_ql/backends/pyusb.py", line 149, in _write
self.write_dev.write(data, int(self.write_timeout))
File "/Users/michael/bin/mypyenv/lib/python3.8/site-packages/usb/core.py", line 408, in write
return self.device.write(self, data, timeout)
File "/Users/michael/bin/mypyenv/lib/python3.8/site-packages/usb/core.py", line 979, in write
return fn(
File "/Users/michael/bin/mypyenv/lib/python3.8/site-packages/usb/backend/libusb1.py", line 837, in bulk_write
return self.__write(self.lib.libusb_bulk_transfer,
File "/Users/michael/bin/mypyenv/lib/python3.8/site-packages/usb/backend/libusb1.py", line 938, in __write
_check(retval)
File "/Users/michael/bin/mypyenv/lib/python3.8/site-packages/usb/backend/libusb1.py", line 602, in _check
raise USBTimeoutError(_strerror(ret), ret, _libusb_errno[ret])
I was using Linux at the time, where the first available printer is fairly predictably lp0, that's where I got the address from. This might not work for macOS.
Anyways it's been a few years so I'm hazy on the details. Good luck debugging!
@rec0de thanks for the feedback.
I found a workaround: call os.system()
instead. I know you've probably moved-on but this message might help someone else :)
os.system("brother_ql --model QL-800 --backend pyusb --printer usb://0x04f9:0x209b print -d --label 62 {}".format(random_sticker["filepath"]))
Hi there! I just found this awesome tool after losing my mind over brother drivers for a few hours and ran into some trouble with my QL-700 printer. Printing a label fails somewhere halfway with hardware buttons becoming unresponsive until I restart the printer. The issue seems to be very similar to #11 from what I can tell.
Here's a debug log of the print job:
Any help would be much appreciated :) Thanks!
Update: I got it to work by using
file:///dev/usb/lp0
as the printer URI instead ofusb://0x04f9:0x2042
with pyusb backend.