1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Printing Image with brother_ql library in Python on Windows 11: Operation not...

Discussão em 'Python' iniciado por Stack, Setembro 13, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to print an image on a Brother QL-560 using brother_ql lib in python on Windows 11.

    My code looks like this:

    from PIL import Image
    from brother_ql.conversion import convert
    from brother_ql.backends.helpers import send, discover
    from brother_ql.raster import BrotherQLRaster
    import logging

    logging.basicConfig(level=logging.DEBUG)

    image = Image.open(r'.\screenshot.png')
    size = (720, 1008)
    image = image.resize(size)

    backend = 'pyusb'
    #find printer
    #print(discover(backend))
    printer = 'usb://0x04f9:0x2027'
    model = 'QL-560'

    qlr = BrotherQLRaster(model)
    qlr.exception_on_warning = True

    instructions = convert(
    qlr=qlr,
    images=[image],
    label='62',
    rotate='90', # 'Auto', '0', '90', '270'
    threshold=70.0, # Black and white threshold in percent.
    dither=False,
    compress=False,
    dpi_600=False,
    hq=True,
    cut=True
    )

    send(instructions=instructions, printer_identifier=printer, backend_identifier=backend, blocking=True)



    And it returns the following error:

    deprecation warning: brother_ql.devicedependent is deprecated and will be removed in a future release
    WARNING:brother_ql.conversion:Need to resize the image...
    DEBUG:brother_ql.raster:raster_image_size: 720x497
    Traceback (most recent call last):
    File "C:\Users\User\PycharmProjects\labelCreator\listUSB.py", line 42, in <module>
    send(instructions=instructions, printer_identifier=printer, backend_identifier=backend, blocking=True)
    File "C:\Users\User\PycharmProjects\labelCreator\venv\lib\site-packages\brother_ql\backends\helpers.py", line 57, in send
    printer = BrotherQLBackend(printer_identifier)
    File "C:\Users\User\PycharmProjects\labelCreator\venv\lib\site-packages\brother_ql\backends\pyusb.py", line 101, in __init__
    self.dev.set_configuration()
    File "C:\Users\User\PycharmProjects\labelCreator\venv\lib\site-packages\usb\core.py", line 915, in set_configuration
    self._ctx.managed_set_configuration(self, configuration)
    File "C:\Users\User\PycharmProjects\labelCreator\venv\lib\site-packages\usb\core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
    File "C:\Users\User\PycharmProjects\labelCreator\venv\lib\site-packages\usb\core.py", line 158, in managed_set_configuration
    self.managed_open()
    File "C:\Users\User\PycharmProjects\labelCreator\venv\lib\site-packages\usb\core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
    File "C:\Users\User\PycharmProjects\labelCreator\venv\lib\site-packages\usb\core.py", line 131, in managed_open
    self.handle = self.backend.open_device(self.dev)
    File "C:\Users\User\PycharmProjects\labelCreator\venv\lib\site-packages\usb\backend\libusb1.py", line 804, in open_device
    return _DeviceHandle(dev)
    File "C:\Users\User\PycharmProjects\labelCreator\venv\lib\site-packages\usb\backend\libusb1.py", line 652, in __init__
    _check(_lib.libusb_open(self.devid, byref(self.handle)))
    File "C:\Users\User\PycharmProjects\labelCreator\venv\lib\site-packages\usb\backend\libusb1.py", line 600, in _check
    raise NotImplementedError(_strerror(ret))
    NotImplementedError: Operation not supported or unimplemented on this platform

    Process finished with exit code 1


    What am I missing? Are my drivers not compatible?

    I have installed libusb-1.0.20 and added MS64/dll to PATH variable and copied libusb-1.0.dll to System32. My Brother QL-560 has all necessary drivers and is working flawlessly with P-Touch Editor.

    Continue reading...

Compartilhe esta Página