Giter Club home page Giter Club logo

pklaus / brother_ql Goto Github PK

View Code? Open in Web Editor NEW
525.0 24.0 141.0 182 KB

Python package for the raster language protocol of the Brother QL series label printers (QL-500, QL-550, QL-560, QL-570, QL-700, QL-710W, QL-720NW, QL-800, QL-810W, QL-820NWB, QL-1050, QL-1060N and more).

Home Page: https://brother-ql.net

License: GNU General Public License v3.0

Python 100.00%
brother label-printer ql-500 ql-550 ql-570 ql-700 ql-710w ql-720nw ql-800 ql-820nwb

brother_ql's People

Contributors

bmanifold avatar bonboncolovich avatar jleguen avatar michieldwitte avatar pklaus avatar russss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brother_ql's Issues

ImportError: No module named brother_ql.create

I installed brother_ql on Raspberry Pi 2 (Raspbian).
I test the main cmd:
$ brother_ql_create --model QL-500 ./720x300_monochrome.png > 720x300_monochrome.bin

and got this error:

Traceback (most recent call last):
File "/usr/local/bin/brother_ql_create", line 9, in
load_entry_point('brother-ql==0.6-dev', 'console_scripts', 'brother_ql_create')()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
['name'])
ImportError: No module named brother_ql.create

Call brother_ql from PHP

Is there is a way to call brother_ql from a php script?

I'm trying it but I get this error

Traceback (most recent call last): File "/usr/bin/brother_ql", line 7, in from brother_ql.cli import cli ImportError: No module named brother_ql.cli

[Brother QL-570] Red flashing while printing

I'm using QL-570 Model. Label type: Prestige Cartridge RB22205 (62 mm x 30.48 m).

Printing:

brother_ql_print Desktop/etiqueta.bin usb://0x04f9:0x2028
ERROR:brother_ql.reader:Error: Transmission / Communication error
ERROR:brother_ql.brother_ql_print:Errors occured: ['Transmission / Communication error']
WARNING:brother_ql.brother_ql_print:Printing potentially not successful?
[1]+  Terminated: 15          brother_ql_print Desktop/etiqueta.bin usb://0x04f9:0x2028

Red flashing while printing and Utility status monitor printer:

QL-570
USB
62mm
Ha ocurrido un error por una causa desconocida (An error has occurred from an unknown cause)

Debugging:

brother_ql_debug Desktop/etiqueta.bin usb://0x04f9:0x2028
INFO: CMD preamble FOUND. Instruction: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [...] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
INFO: CMD init FOUND. Instruction: 1B 40 
INFO: CMD status request FOUND. Instruction: 1B 69 53 
INFO: Response from the device: 80 20 42 34 32 30 00 00 00 00 3E 0A 00 00 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
INFO: Interpretation of the response: 'Reply to status request' (phase: Waiting to receive), 'Continuous length tape' 62x0 mm^2, errors: []
INFO: CMD media/quality FOUND. Instruction: 1B 69 7A CE 0A 3E 00 0A 01 00 00 01 00 
INFO: CMD various FOUND. Instruction: 1B 69 4D 40 
INFO: CMD cut-every FOUND. Instruction: 1B 69 41 01 
INFO: CMD expanded FOUND. Instruction: 1B 69 4B 08 
INFO: CMD margins FOUND. Instruction: 1B 69 64 23 00 
INFO: CMD compression FOUND. Instruction: 4D 02 
INFO: CMD raster FOUND. Instruction: 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 [...] 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 67 00 02 A7 00 
INFO: Response from the device: 80 20 42 34 32 30 00 00 00 04 3E 0A 00 00 15 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00
ERROR: Error: Transmission / Communication error
INFO: Interpretation of the response: 'Error occurred' (phase: Waiting to receive), 'Continuous length tape' 62x0 mm^2, errors: ['Transmission / Communication error']
INFO: CMD print FOUND. Instruction: 1A

Testing with your file:

brother_ql_print Desktop/720x151_monochrome.png usb://0x04f9:0x2028
ERROR:brother_ql.reader:Error: Transmission / Communication error
ERROR:brother_ql.brother_ql_print:Errors occured: ['Transmission / Communication error']
WARNING:brother_ql.brother_ql_print:Printing potentially not successful?

More files attached: (brother_ql_analyse and images)
Archivo comprimido.zip

Edited:
Same result after upgrade:
pip install --upgrade https://github.com/pklaus/brother_ql/archive/master.zip
pip upgrade.zip

Windows support

Hello,

I am able to create an *.bin file from image but can't print it.

Does brother_ql_print *.bin usb://0x04f9:0x2015 support for python on windows?

I am trying a lot but I keep on getting,

Traceback (most recent call last):
  File "c:\users\nischal\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\nischal\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Nischal\AppData\Local\Programs\Python\Python37\Scripts\brother_ql_print.exe\__main__.py", line 9, in <module>
  File "c:\users\nischal\appdata\local\programs\python\python37\lib\site-packages\brother_ql\brother_ql_print.py", line 82, in main
    printer = BrotherQLBackend(string_descr)
  File "c:\users\nischal\appdata\local\programs\python\python37\lib\site-packages\brother_ql\backends\pyusb.py", line 76, in __init__
    for result in list_available_devices():
  File "c:\users\nischal\appdata\local\programs\python\python37\lib\site-packages\brother_ql\backends\pyusb.py", line 43, in list_available_devices
    printers = usb.core.find(find_all=1, custom_match=find_class(7), idVendor=0x04f9)
  File "c:\users\nischal\appdata\local\programs\python\python37\lib\site-packages\usb\core.py", line 1263, in find
    raise NoBackendError('No backend available')
usb.core.NoBackendError: No backend available 

Any response will be highly appreciated.

Installation Error

When installing the software, I have found that there is a problem right after installation: the brother_ql_* programs do not run from the command line. Is there something else I should be doing?

brotherqlerror

QL-800 series support

How likely is it that the QL-800 series works by just adding the relevant entries to devicedependent.py? It also has the ability to somehow print red on some labels - that probably needs extra work? I don't have the printer yet, but I need a printer for a project and I would get the 800 to test, if it is likely to work with brother_ql.

Print number of copies

Hi,

Is there an argument to tell the script to print X number of labels of the same image?

Thanks!

Numpy dependency

reader.py on line 10 is importing Numpy but it isn't needed/used in the module. Seems to be a leftover from old code that is causing errors since it's not installed.

No backend avaiable using pyUsb on Macos (10.11 & 10.12beta)

System Mac OS X (10.11)
Printer QL-570

I followed the final instructions as follows,

pip install pyusb

And run:

brother_ql_print 720x151_monochrome.bin usb://0x04f9:0x2028

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/bin/brother_ql_print", line 9, in <module>
    load_entry_point('brother-ql==0.6.dev0', 'console_scripts', 'brother_ql_print')()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/brother_ql/brother_ql_print.py", line 67, in main
    printer = BrotherQLBackend(string_descr)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/brother_ql/backends/pyusb.py", line 75, in __init__
    for result in list_available_devices():
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/brother_ql/backends/pyusb.py", line 43, in list_available_devices
    printers = usb.core.find(find_all=1, custom_match=find_class(7), idVendor=0x04f9)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/usb/core.py", line 1263, in find
    raise NoBackendError('No backend available')
usb.core.NoBackendError: No backend available

Is it possible to find an alternative not using pyusb in macos with this printer model?
Bug on pyUsb

Error: Printer can be specified either String or os open call

I set up my env and in terminal I did:

(env) $ export BROTHER_QL_PRINTER=file:///dev/usb/lp0
(env) $ export BROTHER_QL_MODEL=QL-700
(env) $ brother_ql print -l 62 my_image.png

But every time I get NotImplementedError('Currently the printer can be specified either via an appropriate string or via an os.open() handle.')

raise NotImplementedError('Currently the printer can be specified either via an appropriate string or via an os.open() handle.')

I can verify that printing works because I tested it with the legacy CLI tools.

Disable auto power off

Hi,

Is there a solution using brother_ql to disable auto power off of the printer ?

I know it's possible using Windows or Mac utilities, but I'm working on a project which will use Brother printers at large scale and I would like to be able to disable it directly from linux, avoiding the need to pre-configure the printer.

unsupported operand type(s)

Hey,
while creating the .bin-file I always get this message. It still work's but wanted to let you know that this occurs:

WARNING:brother_ql.brother_ql_create:Need to resize the image...
Traceback (most recent call last):
  File "/usr/local/bin/brother_ql_print", line 11, in <module>
    load_entry_point('brother-ql==0.6.dev0', 'console_scripts', 'brother_ql_print')()
  File "/usr/local/lib/python2.7/dist-packages/brother_ql/brother_ql_print.py", line 85, in main
    result = interpret_response(data)
  File "/usr/local/lib/python2.7/dist-packages/brother_ql/reader.py", line 157, in interpret_response
    if error_info_1 & (1 << error_bit):
TypeError: unsupported operand type(s) for &: 'str' and 'int'

Thanks a lot for the library!

Cheers

model unknown QL-810W

I installed libusb-win32 and key "brother_ql -b pyusb discover"
It's display Found a label printer: usb//0x04f9:0x209c model:unknown

My device model name is QL-810W

Fix for error: invalid command 'bdist_wheel'

When installing getting the error:

error: invalid command 'bdist_wheel'
...
Failed building wheel for packbits

do first

sudo apt-get install python-wheel

Please add this to the documentation.

Extra Label Size

Hi,

Thanks for your awesome package, works like a charm!

There is however one thing, we've purchased a Brother QL-1060N, with address labels. The format looks like it's 102x152 mm, but it is 102x153 mm.

That means it flashes red when printing in the 102x152 format.

We've modified devicedependent.py ourselves, and added the extra label size, however if other people experience the same problem, permanent implementation in the repository would be great:

"102x153":{'tape_size': (102, 153), 'dots_total': (1200, 1804), 'dots_printable': (1164, 1660), 'right_margin_dots': 12, 'feed_margin': 0},

Keep up the good work!

AssertionError on finish printing

Thanks for this cool library! It works almost perfect on my Raspberry Pi 3!

Anyway, I keep having this "AssesrtionError" prompting up after each successful printing. I wonder if it's my environment issue or the printer is not responding correctly?

  • Printer is QL-700, USB connected to Raspberry Pi 3
  • Installed this driver and as well as pyusb (I can't see lp in /dev/usb)
  • brother_ql_create -m QL-700 -s 62 /some/cat/image.png > test.bin
  • brother_ql_print test.bin usb://0x04f9:0x2042

After the print command, the image did printed on the label printer correctly, but in the console there is this assertion error:

Traceback (most recent call last):
  File "/usr/local/bin/brother_ql_print", line 9, in <module>
    load_entry_point('brother-ql==0.7.4', 'console_scripts', 'brother_ql_print')()
  File "/usr/local/lib/python2.7/dist-packages/brother_ql/brother_ql_print.py", line 92, in main
    result = interpret_response(data)
  File "/usr/local/lib/python2.7/dist-packages/brother_ql/reader.py", line 153, in interpret_response
    assert data.startswith(b'\x80\x20\x42')
AssertionError

Any idea?

Creating instruction file on script and printing on QL-800

The following code works perfectly (creates abc.bin file and prints from the printer) on command prompt:

brother_ql_create --model QL-800 --red abc.png --label-size 62> abc.bin
brother_ql_print abc.bin usb://0x04F9:0x209B

On python script:

from brother_ql import brother_ql_create
from brother_ql import brother_ql_print
from PIL.ImageTk import PhotoImage

brother_ql_create --model QL-800 --red abc.png --label-size 62> abc.bin_

Error: 'QL' is invalid syntax

Why is it not possible to call the following line on python script?
Is there any other method to create instruction file and print from script?

It would be great if you had a test script to create and print on your library.

Printing aborts on QL-700

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:

INFO:brother_ql.backends.helpers:Sending instructions to the printer. Total: 64964 bytes.
DEBUG:brother_ql.backends.generic:Writing 64964 bytes.
DEBUG:brother_ql.backends.generic:Read 32 bytes.
DEBUG:brother_ql.reader:Byte  0         Print head mark: 80
DEBUG:brother_ql.reader:Byte  1                    Size: 20
DEBUG:brother_ql.reader:Byte  2          Fixed (B=0x42): 42
DEBUG:brother_ql.reader:Byte  3        Device dependent: 34
DEBUG:brother_ql.reader:Byte  4        Device dependent: 35
DEBUG:brother_ql.reader:Byte  5          Fixed (0=0x30): 30
DEBUG:brother_ql.reader:Byte  6  Fixed (0x00 or 0=0x30): 00
DEBUG:brother_ql.reader:Byte  7            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte  8     Error information 1: 00
DEBUG:brother_ql.reader:Byte  9     Error information 2: 00
DEBUG:brother_ql.reader:Byte 10             Media width: 3E
DEBUG:brother_ql.reader:Byte 11              Media type: 0A
DEBUG:brother_ql.reader:Byte 12            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte 13            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte 14                Reserved: 15
DEBUG:brother_ql.reader:Byte 15                    Mode: 00
DEBUG:brother_ql.reader:Byte 16            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte 17            Media length: 00
DEBUG:brother_ql.reader:Byte 18             Status type: 00
DEBUG:brother_ql.reader:Byte 19              Phase type: 00
DEBUG:brother_ql.reader:Byte 20     Phase number (high): 00
DEBUG:brother_ql.reader:Byte 21      Phase number (low): 00
DEBUG:brother_ql.reader:Byte 22     Notification number: 00
DEBUG:brother_ql.reader:Byte 23                Reserved: 00
DEBUG:brother_ql.reader:Byte 24                Reserved: 00
DEBUG:brother_ql.reader:Media type: Continuous length tape
DEBUG:brother_ql.reader:Status type: Reply to status request
DEBUG:brother_ql.reader:Phase type: Waiting to receive
DEBUG:brother_ql.backends.helpers:TIME 5.026 - result: {'status_type': 'Reply to status request', 'phase_type': 'Waiting to receive', 'media_type': 'Continuous length tape', 'media_width': 62, 'media_length': 0, 'errors': []}
DEBUG:brother_ql.backends.generic:Read 32 bytes.
DEBUG:brother_ql.reader:Byte  0         Print head mark: 80
DEBUG:brother_ql.reader:Byte  1                    Size: 20
DEBUG:brother_ql.reader:Byte  2          Fixed (B=0x42): 42
DEBUG:brother_ql.reader:Byte  3        Device dependent: 34
DEBUG:brother_ql.reader:Byte  4        Device dependent: 35
DEBUG:brother_ql.reader:Byte  5          Fixed (0=0x30): 30
DEBUG:brother_ql.reader:Byte  6  Fixed (0x00 or 0=0x30): 00
DEBUG:brother_ql.reader:Byte  7            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte  8     Error information 1: 00
DEBUG:brother_ql.reader:Byte  9     Error information 2: 00
DEBUG:brother_ql.reader:Byte 10             Media width: 3E
DEBUG:brother_ql.reader:Byte 11              Media type: 0A
DEBUG:brother_ql.reader:Byte 12            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte 13            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte 14                Reserved: 15
DEBUG:brother_ql.reader:Byte 15                    Mode: 00
DEBUG:brother_ql.reader:Byte 16            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte 17            Media length: 00
DEBUG:brother_ql.reader:Byte 18             Status type: 06
DEBUG:brother_ql.reader:Byte 19              Phase type: 01
DEBUG:brother_ql.reader:Byte 20     Phase number (high): 00
DEBUG:brother_ql.reader:Byte 21      Phase number (low): 00
DEBUG:brother_ql.reader:Byte 22     Notification number: 00
DEBUG:brother_ql.reader:Byte 23                Reserved: 00
DEBUG:brother_ql.reader:Byte 24                Reserved: 00
DEBUG:brother_ql.reader:Media type: Continuous length tape
DEBUG:brother_ql.reader:Status type: Phase change
DEBUG:brother_ql.reader:Phase type: Printing state
DEBUG:brother_ql.backends.helpers:TIME 5.043 - result: {'status_type': 'Phase change', 'phase_type': 'Printing state', 'media_type': 'Continuous length tape', 'media_width': 62, 'media_length': 0, 'errors': []}
WARNING:brother_ql.backends.helpers:'printing completed' status not received.
WARNING:brother_ql.backends.helpers:'waiting to receive' status not received.
WARNING:brother_ql.backends.helpers:Printing potentially not successful?

Any help would be much appreciated :)
Thanks!

Update: I got it to work by using file:///dev/usb/lp0 as the printer URI instead of usb://0x04f9:0x2042 with pyusb backend.

ERROR: Couln't interpret response from QL-1050

Hello,

I'm trying to print to my QL-1050 on a 102x152 sticker.
When the job is sent, the printer LED turns blinking red.
Looking at the DEBUG Doc I was able to get the following information.
It looks like some response cannot be interpreted.
If you need further information, just tell me which command to run.
Thanks

INFO: CMD mode setting FOUND. Instruction: 1B 69 61 01
INFO: CMD preamble FOUND. Instruction: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0                                                                0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00                                                                 00 00 00 00 [...] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
INFO: CMD init FOUND. Instruction: 1B 40
INFO: CMD mode setting FOUND. Instruction: 1B 69 61 01
INFO: CMD status request FOUND. Instruction: 1B 69 53
INFO: Response from the device: 80 20 42 30 50 30 00 00 00 00 66 0B 00 00 2E 00 00 99 00 00 00 00 00 00 00 00 00 00 00                                                                 00 00 00
ERROR: Couln't interpret response: 80 20 42 30 50 30 00 00 00 00 66 0B 00 00 2E 00 00 99 00 00 00 00 00 00 00 00 00 00                                                                 00 00 00 00
INFO: CMD media/quality FOUND. Instruction: 1B 69 7A CE 0B 66 98 7C 06 00 00 00 00
INFO: CMD various FOUND. Instruction: 1B 69 4D 40
INFO: CMD cut-every FOUND. Instruction: 1B 69 41 01
INFO: CMD expanded FOUND. Instruction: 1B 69 4B 08
INFO: CMD margins FOUND. Instruction: 1B 69 64 00 00
INFO: CMD raster FOUND. Instruction: 67 00 A2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [...] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
INFO: Response from the device: 80 20 42 30 50 30 00 00 00 00 66 0B 00 00 2E 00 00 99 06 01 00 00 00 00 00 00 00 00 00 00 00 00
ERROR: Couln't interpret response: 80 20 42 30 50 30 00 00 00 00 66 0B 00 00 2E 00 00 99 06 01 00 00 00 00 00 00 00 00 00 00 00 00
INFO: CMD print FOUND. Instruction: 1A
INFO: Response from the device: 80 20 42 30 50 30 00 00 00 01 66 0B 00 00 2E 00 00 99 02 01 00 00 00 00 00 00 00 00 00 00 00 00
ERROR: Couln't interpret response: 80 20 42 30 50 30 00 00 00 01 66 0B 00 00 2E 00 00 99 02 01 00 00 00 00 00 00 00 00 00 00 00 00```
  

Printer not finishing job correctly

Hi there, thank your for your awesome work! I am building stuff with a Raspberry Pi and a Brother QL-570 printer.

However, I have a problem when printing the generated bin. After printing, the printer won't cut the label off - and it also becomes unresponsive (not accepting any new print jobs) until I restart it with the power button. Seems like something isn't finished correctly.

Debug:

pi@raspberrypi:~ $ brother_ql_create --model QL-570 --label-size 29x90 --loglevel DEBUG ./image.png > label.bin
INFO:brother_ql.raster:raster_image_size: 720x991

pi@raspberrypi:~ $ brother_ql_print --debug label.bin /dev/usb/lp0
INFO:brother_ql.brother_ql_print:Sending instructions to the printer. Total: 92306 bytes.
DEBUG:brother_ql.backends.generic:Writing 92306 bytes.
DEBUG:brother_ql.backends.generic:Read 32 bytes.
DEBUG:brother_ql.reader:Byte  0         Print head mark: 80
DEBUG:brother_ql.reader:Byte  1                    Size: 20
DEBUG:brother_ql.reader:Byte  2          Fixed (B=0x42): 42
DEBUG:brother_ql.reader:Byte  3        Device dependent: 34
DEBUG:brother_ql.reader:Byte  4        Device dependent: 32
DEBUG:brother_ql.reader:Byte  5          Fixed (0=0x30): 30
DEBUG:brother_ql.reader:Byte  6  Fixed (0x00 or 0=0x30): 00
DEBUG:brother_ql.reader:Byte  7            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte  8     Error information 1: 00
DEBUG:brother_ql.reader:Byte  9     Error information 2: 00
DEBUG:brother_ql.reader:Byte 10             Media width: 1D
DEBUG:brother_ql.reader:Byte 11              Media type: 0B
DEBUG:brother_ql.reader:Byte 12            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte 13            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte 14                Reserved: 01
DEBUG:brother_ql.reader:Byte 15                    Mode: 00
DEBUG:brother_ql.reader:Byte 16            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte 17            Media length: 5A
DEBUG:brother_ql.reader:Byte 18             Status type: 00
DEBUG:brother_ql.reader:Byte 19              Phase type: 00
DEBUG:brother_ql.reader:Byte 20     Phase number (high): 00
DEBUG:brother_ql.reader:Byte 21      Phase number (low): 00
DEBUG:brother_ql.reader:Byte 22     Notification number: 00
DEBUG:brother_ql.reader:Byte 23                Reserved: 00
DEBUG:brother_ql.reader:Byte 24                Reserved: 00
DEBUG:brother_ql.reader:Media type: Die-cut labels
DEBUG:brother_ql.reader:Status type: Reply to status request
DEBUG:brother_ql.reader:Phase type: Waiting to receive
DEBUG:brother_ql.brother_ql_print:TIME 3.172 - result: {'status_type': 'Reply to status request', 'errors': [], 'media_type': 'Die-cut labels', 'phase_type': 'Waiting to receive', 'media_width': 29, 'media_length': 90}
DEBUG:brother_ql.backends.generic:Read 32 bytes.
DEBUG:brother_ql.reader:Byte  0         Print head mark: 80
DEBUG:brother_ql.reader:Byte  1                    Size: 20
DEBUG:brother_ql.reader:Byte  2          Fixed (B=0x42): 42
DEBUG:brother_ql.reader:Byte  3        Device dependent: 34
DEBUG:brother_ql.reader:Byte  4        Device dependent: 32
DEBUG:brother_ql.reader:Byte  5          Fixed (0=0x30): 30
DEBUG:brother_ql.reader:Byte  6  Fixed (0x00 or 0=0x30): 00
DEBUG:brother_ql.reader:Byte  7            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte  8     Error information 1: 00
DEBUG:brother_ql.reader:Byte  9     Error information 2: 00
DEBUG:brother_ql.reader:Byte 10             Media width: 1D
DEBUG:brother_ql.reader:Byte 11              Media type: 0B
DEBUG:brother_ql.reader:Byte 12            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte 13            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte 14                Reserved: 01
DEBUG:brother_ql.reader:Byte 15                    Mode: 00
DEBUG:brother_ql.reader:Byte 16            Fixed (0x00): 00
DEBUG:brother_ql.reader:Byte 17            Media length: 5A
DEBUG:brother_ql.reader:Byte 18             Status type: 06
DEBUG:brother_ql.reader:Byte 19              Phase type: 01
DEBUG:brother_ql.reader:Byte 20     Phase number (high): 00
DEBUG:brother_ql.reader:Byte 21      Phase number (low): 00
DEBUG:brother_ql.reader:Byte 22     Notification number: 00
DEBUG:brother_ql.reader:Byte 23                Reserved: 00
DEBUG:brother_ql.reader:Byte 24                Reserved: 00
DEBUG:brother_ql.reader:Media type: Die-cut labels
DEBUG:brother_ql.reader:Status type: Phase change
DEBUG:brother_ql.reader:Phase type: Printing state
DEBUG:brother_ql.brother_ql_print:TIME 3.178 - result: {'status_type': 'Phase change', 'errors': [], 'media_type': 'Die-cut labels', 'phase_type': 'Printing state', 'media_width': 29, 'media_length': 90}

After this, it takes a few seconds until the following shows up:

WARNING:brother_ql.brother_ql_print:Printing potentially not successful?

Any ideas on what might be causing this? Model number and label size is correct.

Thanks.

pyusb multiple devices

hi
how can i print if i have multiple devices with the same brand and product?

thank u

Dynamic labels

Hello there,

we have to create dynamic labels. Printing serial numbers onto devices. What would be a propper way to create and print them with brother_ql?

Thanks in advance

Works from cli, not from script

Need help please, dont know what am i doing wrong. The following line:

brother_ql_create --model QL-710W /home/administrador/etiquetas/etiqueta.png > /home/administrador/etiquetas/etiqueta_monochrome.bin

works when running the script from the command line, but outputs a file of length 0 when called by a cron script. Thank you.

QL-820NWB Error wrong roll type

Hi i run this command:
brother_ql print -l 62 tmp.png

And in terminal get:
WARNING:brother_ql.conversion:Need to resize the image...
INFO:brother_ql.backends.helpers:Sending instructions to the printer. Total: 5731 bytes.

But in printer error wrong roll type

[Brother QL-570] Black Square Printout

Hello pklaus and thanks a lot for the awesome idea!
I am using QL-570 with Raspberry Pis as Invoice Printer, however, the cups drivers are less than usable and so I stumbled upon your tool - and really want to use it (as my input data is transfered as png files via python.. so.. could be good ๐Ÿ‘)

However, the setup sadly does not work.
I am using an QL-570 with 54 / 590 / (54 mm endless) tape and the -to-be-wished- result would be an all page print out of the reciepe as seen in the added file. However, I only get an black square with the first file (cafe.png) and an black square with less "white space" / tape (cafe90.png). I included the bin files and png files as well.

And following errors:

root@demo:/home/pi/test# brother_ql_create --model QL-570 --label-size 54 ./cafe.png cafe.bin
root@demo:/home/pi/test# brother_ql_create --model QL-570 --label-size 54 ./cafe90.png cafe90.bin
root@demo:/home/pi/test# brother_ql_print cafe.bin /dev/usb/lp0
Traceback (most recent call last):
  File "/usr/local/bin/brother_ql_print", line 9, in <module>
    load_entry_point('brother-ql==0.6-dev', 'console_scripts', 'brother_ql_print')()
  File "/usr/local/lib/python2.7/dist-packages/brother_ql/brother_ql_print.py", line 85, in main
    result = interpret_response(data)
  File "/usr/local/lib/python2.7/dist-packages/brother_ql/reader.py", line 157, in interpret_response
    if error_info_1 & (1 << error_bit):
TypeError: unsupported operand type(s) for &: 'str' and 'int'
root@demo:/home/pi/test# brother_ql_print cafe90.bin /dev/usb/lp0
Traceback (most recent call last):
  File "/usr/local/bin/brother_ql_print", line 9, in <module>
    load_entry_point('brother-ql==0.6-dev', 'console_scripts', 'brother_ql_print')()
  File "/usr/local/lib/python2.7/dist-packages/brother_ql/brother_ql_print.py", line 85, in main
    result = interpret_response(data)
  File "/usr/local/lib/python2.7/dist-packages/brother_ql/reader.py", line 157, in interpret_response
    if error_info_1 & (1 << error_bit):
TypeError: unsupported operand type(s) for &: 'str' and 'int'

You can download the file here https://jctixx.de/download/QL570Test.zip

If I can help you out with test prints or such, just let me know.
Also, I tried to play with the treshold setting - it did not make it less or more black :(

suppress warnings

Hi,

is there a way to suppress following messages:

Trying to switch the operating mode on a printer that doesn't support the command.
Trying to switch the operating mode on a printer that doesn't support the command.
Need to resize the image...

thanks

Cannot print 24 dia labels

While trying to create 24mm diameter labels, an error about mismatching picture dimentions occurs.

Interesting is, when you add:
logger.warning(im.size[0]) logger.warning(im.size[1]) logger.warning(dots_printable[0]) logger.warning(dots_printable[1])
to "brother_ql_create.py", it will output 236 for each warning.

Anyhow, it will exit on:
if im.size[0] != dots_printable[0] or im.size[1] != dots_printable[1]: sys.exit("Check your image dimensions. Expecting: " + str(dots_printable))

600x300 dpi support

What needs to be done to support the 600x300 dpi mode? I have a QL-710W and am willing to help.

QL-800 red blinking light when print issued

  • Model: Brother QL-800
  • Hardware: Raspberry Pi B+
  • OS: Raspbian GNU/Linux 9
  • Connection method: USB
  • The logo I want to print, as a jpg:
    logo

Setup...

  1. Tried with Python 2 and 3: pip3 install --upgrade brother_ql
  2. Add to path: export PATH="${PATH}:~/.local/bin"
  3. Find my printer details: sudo lsusb -v
  4. Constructed my PyUSB string like so: usb://0x04f9:0x209b/____

Steps I took...

  1. Create bin file
pi@raspberrypi:~ $ brother_ql_create --model "QL-800" logo.jpg --label-size 62 > logo.bin
  1. Use bin file to print
pi@raspberrypi:~ $ brother_ql_print logo.bin usb://0x04f9:0x209b/____
deprecation warning: brother_ql.devicedependent is deprecated and will be removed in a future release
INFO:brother_ql.backends.helpers:Sending instructions to the printer. Total: 64972 bytes.
WARNING:brother_ql.backends.helpers:'printing completed' status not received.
WARNING:brother_ql.backends.helpers:'waiting to receive' status not received.
WARNING:brother_ql.backends.helpers:Printing potentially not successful?
  1. red light blinks...
  2. Try to run analyse to simulate what the printer is going to get and render:
pi@raspberrypi:~ $ brother_ql_analyse logo.bin --loglevel DEBUG
  1. Reviewed output from analyse execution and things look good.
  2. I even get a logo as a result of the analyse process, as a png
  3. I try to run the debug command to see if there is any extra information.
pi@raspberrypi:~ $ brother_ql_debug logo.bin usb://0x04f9:0x209b/____
deprecation warning: brother_ql.devicedependent is deprecated and will be removed in a future release
INFO: CMD mode setting FOUND. Instruction: 1B 69 61 01 
INFO: CMD preamble FOUND. Instruction: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [...] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
INFO: CMD init FOUND. Instruction: 1B 40 
INFO: CMD mode setting FOUND. Instruction: 1B 69 61 01 
INFO: CMD status request FOUND. Instruction: 1B 69 53 
INFO: Response from the device: 80 20 42 34 38 30 00 00 00 00 3E 0A 00 00 23 00 00 00 00 00 00 00 00 00 00 81 00 00 00 00 00 00
INFO: Interpretation of the response: 'Reply to status request' (phase: Waiting to receive), 'Continuous length tape' 62x0 mm^2, errors: []
INFO: CMD media/quality FOUND. Instruction: 1B 69 7A CE 0A 3E 00 B8 02 00 00 00 00 
INFO: CMD various FOUND. Instruction: 1B 69 4D 40 
INFO: CMD cut-every FOUND. Instruction: 1B 69 41 01 
INFO: CMD expanded FOUND. Instruction: 1B 69 4B 08 
INFO: CMD margins FOUND. Instruction: 1B 69 64 23 00 
INFO: CMD raster FOUND. Instruction: 67 00 5A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [...] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
INFO: Response from the device: 80 20 42 34 38 30 00 00 00 00 3E 0A 00 00 23 00 00 00 06 01 00 00 00 00 00 81 00 00 00 00 00 00
INFO: Interpretation of the response: 'Phase change' (phase: Printing state), 'Continuous length tape' 62x0 mm^2, errors: []
INFO: CMD print FOUND. Instruction: 1A 
INFO: Response from the device: 80 20 42 34 38 30 00 00 00 00 3E 0A 00 00 23 00 00 00 02 01 00 00 00 00 00 81 00 00 00 00 00 24
INFO: Interpretation of the response: 'Error occurred' (phase: Printing state), 'Continuous length tape' 62x0 mm^2, errors: []
  1. Everything looks good until then end when there is an error in the printing phase that does not get bubbled up.

Usage example/documentation for using in another python script instead of the CLI?

Is there any documentation or a usage example for using brother_ql as a module rather than from the CLI? I can call the command line from my python script just fine but I find that a little inelegant. I was hoping there might be some documentation of the functions and what to include that might save me having to trace through all the code and come up with such documentation myself.

Print speed

I was using your package on an Aria G25 by Acme Systems (it's packed with a 400 MHz Atmel processor) to print to a QL-710W and it worked fine, the problem was speed: it took about 8 seconds to convert the png to raster and then print it.
I did some digging and found a pair of bottlenecks. The first one is the frame b/w invertion on the raster's add_raster_data function. That alone took around 5 seconds. The second one was the string concatenation of the raster data in the same function, which took around 2 seconds. So I made some workarounds and got the whole process to just over 1 second.

First, instead of doing your own inversion, you could lest Pillow invert the png just after resize:

im = PIL.ImageOps.invert(im)

Then, avoid string concatenation overhead using whatever better method you prefer. I did it by writing to a pseudo file and then setting the data to the file's value:

        file_str = StringIO()

        while start + row_len <= frame_len:
            row = frame[start:start+row_len]
            start += row_len
            file_str.write(b'\x67\x00')
            if self._compression:
                row = packbits.encode(row)
            file_str.write(bytes([len(row)]))
            file_str.write(row)

        self.data += file_str.getvalue()

There's one more optimization you may use in that loop if your device has more than once core (mine doesn't): you could parallelize the frame to data transfer. For example, if your device has 2 cores, just start 2 threads/processes and let each one deal with half the frame, then write to data in order. In my Aria of course that didn't help, but you should see an improvement in a Rasperry Pi, for example.

All this was tested with a CPython implementaion of Python 2.7. Anyway, just thought I should mention it if anyone is trying to use your package in a low-end device. If you like my proposals, I could clone your repo, make the changes and do a pull request, or you could just implement them yourself if you prefer. Let me know.

Cheers.

QL-500 does not print

Hello,
first of all thanks for that great library.

But we have a problem by printing a round label (d24 -> 236x236).

the labela was created without any errors by:
brother_ql_create --model QL-500 --label-size d24 ./EOL-Test.png > EOL_Test.bin

the debug output of brother_ql_debug ./EOL_Test.bin /dev/usb/lp0 is:

INFO: CMD preamble FOUND. Instruction: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [...] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
INFO: CMD init FOUND. Instruction: 1B 40
INFO: CMD status request FOUND. Instruction: 1B 69 53
INFO: Response from the device: 80 20 42 30 4F 30 00 00 00 00 18 0B 00 00 12 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ERROR: Couln't interpret response: 80 20 42 30 4F 30 00 00 00 00 18 0B 00 00 12 00 00 18 00 00 00 00 00 00 00 00 00 00 00 00 00 00
INFO: CMD media/quality FOUND. Instruction: 1B 69 7A CE 0B 18 18 EC 00 00 00 00 00
INFO: CMD margins FOUND. Instruction: 1B 69 64 00 00
INFO: CMD raster FOUND. Instruction: 67 00 5A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [...] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
INFO: Response from the device: 80 20 42 30 4F 30 00 00 00 00 18 0B 00 00 12 00 00 18 06 01 00 00 00 00 00 00 00 00 00 00 00 00
ERROR: Couln't interpret response: 80 20 42 30 4F 30 00 00 00 00 18 0B 00 00 12 00 00 18 06 01 00 00 00 00 00 00 00 00 00 00 00 00
INFO: CMD print FOUND. Instruction: 1A
INFO: Response from the device: 80 20 42 30 4F 30 00 00 00 40 18 0B 00 00 12 00 00 18 02 01 00 00 00 00 00 00 00 00 00 00 00 00
ERROR: Couln't interpret response: 80 20 42 30 4F 30 00 00 00 40 18 0B 00 00 12 00 00 18 02 01 00 00 00 00 00 00 00 00 00 00 00 00

We using debian wheezy and install the upgrade.

Thank you for your help.

USB Operation Timeout while printing label

I'm getting the following error while printing a label on a QL-1060 on 4" endless tape:

usb.core.USBError: [Errno 60] Operation timed out

I think the issue is the 5 second timeout on line 70 in pyusb.py in backends is not high enough for slower print jobs. The job stops about 3/4s from finishing and the printer freezes up.

raspberry pi

Hi,
nice script, but i have a problem at a raspberry pi 3 with raspbian:
the log:

copying lib/matplotlib/tests/baseline_images/test_axes/pcolormesh.png -> build/lib.linux-armv7l-2.7/matplotlib/tests/baseline_images/test_axes

[...]

In file included from src/ft2font.cpp:9:0:

src/mplutils.h:31:20: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden

 #include <Python.h>

                ^

compilation terminated.

error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-Z9mhMv/matplotlib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-D6YooL-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-Z9mhMv/matplotlib
Storing debug log for failure in /root/.pip/pip.log
pi@raspberrypi:~/Downloads $ 

QL-820NWB Permissions/USB Error

I'm able to print labels using the Brother P-Touch Editor via USB but I'm unable to do that via brother_ql. I've tried it on both Ubuntu and Windows 7 with both USB and the Linux Kernel.

Using the print or send command (eg. brother_ql -b pyusb -m QL-820NWB -p usb://0x04f9:0x209d print -l 62 test.png), I get usb.core.USBError: [Errno None] b'libusb0-dll:err [submit_async] submitting request failed, win error: The parameter is incorrect.\r\n'

It also happens when trying to send an instructions file. On Linux, I get a permissions denied error.

ValueError: invalid literal for int() with base 16: 'Brother'

I was trying to print with my Brother QL810W in Ubuntu.
brother_ql print -l 62 label.png

The driver works fine but when I try to use brother_ql I get this error

Traceback (most recent call last):
  File "/home/myhome/.local/bin/brother_ql", line 11, in <module>
    sys.exit(cli())
  File "/home/myhome/.local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/myhome/.local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/myhome/.local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/myhome/.local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/myhome/.local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/myhome/.local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/myhome/.local/lib/python2.7/site-packages/brother_ql/cli.py", line 147, in print_cmd
    send(instructions=instructions, printer_identifier=printer, backend_identifier=backend, blocking=True)
  File "/home/communithings/.local/lib/python2.7/site-packages/brother_ql/backends/helpers.py", line 57, in send
    printer = BrotherQLBackend(printer_identifier)
  File "/home/myhome/.local/lib/python2.7/site-packages/brother_ql/backends/pyusb.py", line 78, in __init__
    vendor, product = int(vendor, 16), int(product, 16)
ValueError: invalid literal for int() with base 16: 'Brother'

I have these exports
export BROTHER_QL_PRINTER=usb://Brother/QL-810W?serial=000L7Z4xxxxx
export BROTHER_QL_MODEL=QL-810W

Am I doing anything wrong?

QL-800 Appears as Mass Storage, not Printer

When I connect the Brother QL-800 to my Ubuntu 18.04 installation, the device appears as a mass storage device, rather than a printer. As a result, brother_ql does not list it as an available device. This occurs whether or not I have installed the Linux printer drivers. How can I tell Ubuntu to recognise the USB device as a printer rather than mass storage? Here is the output of lsusb -v for this device:

Bus 001 Device 016: ID 04f9:209e Brother Industries, Ltd 
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x04f9 Brother Industries, Ltd
  idProduct          0x209e 
  bcdDevice            1.00
  iManufacturer           1 
  iProduct                2 
  iSerial                 3 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0

Add support for QL-1110NWB

Right now I'm using the brother_ql_web with a Brother QL-1110NWB printer.

Unfortunately brother_ql doesn't recognize the QL-1110NWB model, but using the older QL-1050 works. I don't know if there need to be done any further modifications for this model to work properly. As far as I can tell the results seem to be good when using the QL-1050 config.

Getting errors when list-backends

I get this error, I have installed brew install libusb and pip install pyusb

$ brother_ql_print --backend pyusb --list-printers
Traceback (most recent call last):
  File "/usr/local/bin/brother_ql_print", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/brother_ql/brother_ql_print.py", line 37, in main
    with open(args.instruction_file, 'rb') as f:
TypeError: expected str, bytes or os.PathLike object, not NoneType

Using OSX and python 3.6

Installed the lastest dev version, noticed there is no way to get the current version installed of brother_ql

QL-560

I wanted to confirm the functionality of the package with the QL-560.
Using to to automatically print labels for our PC inventory.

Thanks for the package!

Error: Insufficient amount of data received

When printing to my ql-1050 the program aborts after 2/3 of the image with:

brother_ql --backend pyusb --printer usb://0x04f9:0x2020 --model QL-1050 print --label 102x152 --dither /tmp/sample.png
INFO:brother_ql.backends.helpers:Sending instructions to the printer. Total: 274144 bytes.
Traceback (most recent call last):
  File "/usr/bin/brother_ql", line 11, in <module>
    sys.exit(cli())
  File "/usr/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/brother_ql/cli.py", line 147, in print_cmd
    send(instructions=instructions, printer_identifier=printer, backend_identifier=backend, blocking=True)
  File "/usr/lib/python2.7/site-packages/brother_ql/backends/helpers.py", line 76, in send
    result = interpret_response(data)
  File "/usr/lib/python2.7/site-packages/brother_ql/reader.py", line 157, in interpret_response
    raise NameError('Insufficient amount of data received', hex_format(data))
NameError: ('Insufficient amount of data received', '61 72 72 61 79 28 27 42 27 29')

the printer is stuck, wont cut or feed until switched of & on again.

Error brother_ql_analyse and brother_ql_print

Please fix the following error for brother_ql_analyse (and similar problem for brother_ql_print below) as found on Ubuntu 16.04:

brother_ql_analyse test.bin --loglevel DEBUG
/usr/local/lib/python2.7/dist-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
WARNING: unknown opcode starting with 36 32 5D 5B...)
WARNING: unknown opcode starting with 32 5D 5B 30...)
WARNING: unknown opcode starting with 5D 5B 30 5D...)
WARNING: unknown opcode starting with 5B 30 5D C0...)
WARNING: unknown opcode starting with 30 5D C0 06...)
WARNING: unknown opcode starting with 5D C0 06 00...)
WARNING: unknown opcode starting with C0 06 00 00...)
WARNING: unknown opcode starting with 06 00 00 5B...)
WARNING: unknown opcode starting with 5B 54 72 75...)
WARNING: unknown opcode starting with 54 72 75 65...)
WARNING: unknown opcode starting with 72 75 65 5D...)
WARNING: unknown opcode starting with 75 65 5D 00...)
WARNING: unknown opcode starting with 65 5D 00 1B...)
WARNING: unknown opcode starting with 5D 00 1B 69...)
WARNING: unknown opcode starting with 36 34 5D 1B...)
WARNING: unknown opcode starting with 34 5D 1B 69...)
WARNING: unknown opcode starting with 5D 1B 69 41...)
WARNING: unknown opcode starting with 31 5D 1B 69...)
WARNING: unknown opcode starting with 5D 1B 69 4B...)
WARNING: unknown opcode starting with 38 5D 1B 69...)
WARNING: unknown opcode starting with 5D 1B 69 64...)
WARNING: unknown opcode starting with 32 5D 67 00...)
WARNING: unknown opcode starting with 5D 67 00 5B...)
Traceback (most recent call last):
File "/usr/local/bin/brother_ql_analyse", line 9, in
load_entry_point('brother-ql==0.6.dev0', 'console_scripts', 'brother_ql_analyse')()
File "/usr/local/lib/python2.7/dist-packages/brother_ql/brother_ql_analyse.py", line 17, in main
br.analyse()
File "/usr/local/lib/python2.7/dist-packages/brother_ql/reader.py", line 238, in analyse
for instruction in chunker(instructions):
File "/usr/local/lib/python2.7/dist-packages/brother_ql/reader.py", line 138, in chunker
num_bytes += data[2] + 2
TypeError: cannot concatenate 'str' and 'int' objects

Response parse error

OS: Ubuntu Xenial 16.04
Kernel: 4.10.0
Phyton: 2.7.12
PyUSB: 1.0.2
Printer: Brother QL-700
Command Line: sudo brother_ql_debug teste.bin usb://0x04f9:0x2042
image

Even with the above error it prints correctly.

printing with network backend fails

I'm trying to print to a QL-500 printer attached to my router (which provides the print server) to a 62mm endless roll. When use netcat to send the printfile to the printer it works just fine. However when I use brother_ql_print only a the first line gets printed and then the printer needs to be resetted.

Debug output:

$ ./env/bin/brother_ql_print --debug --backend network test.bin tcp://192.168.1.1:9100
WARNING:brother_ql.brother_ql_print:The network backend doesn't supply any 'readback' functionality. No status reports will be received.
INFO:brother_ql.brother_ql_print:Sending instructions to the printer. Total: 290849 bytes.
DEBUG:brother_ql.backends.generic:Writing 290849 bytes.

The reported file size seems to be correct:

$ ls -l test.bin 
-rw-r--r-- 1 andi users 290849 Oct  6 11:05 test.bin

I attached the print file and the original png here. test.zip

Is there anything I can to do help debugging this? From what I understand the network backend just opens a socket and then writes the whole content to it. Could it be that there is some buffering involved that needs to be flushed? (I'm not a python developer).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.