pklaus / brother_ql_web

A Python-based web service to print labels on Brother QL label printers. Based on brother_ql: https://github.com/pklaus/brother_ql
GNU General Public License v3.0
254 stars 124 forks source link

NotImplementedError when attempting to print #13

Closed DoktorJ closed 5 years ago

DoktorJ commented 6 years ago

I have been able to successfully print PNG images using the brother_ql CLI; however, when attempting to print using brother_ql_web, I see the following error on the webserver:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/usr/local/lib/python3.7/site-packages/bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "./brother_ql_web.py", line 198, in print_text
    create_label(qlr, im, context['label_size'], threshold=context['threshold'], cut=True, rotate=rotate)
  File "/usr/local/lib/python3.7/site-packages/brother_ql/brother_ql_create.py", line 54, in create_label
    convert(qlr, [image], label_size, threshold=threshold, cut=cut, dither=dither, compress=compress, red=red, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/brother_ql/conversion.py", line 89, in convert
    raise NotImplementedError("The image argument needs to be an Image() instance or the filename to an image.")
NotImplementedError: The image argument needs to be an Image() instance or the filename to an image.

The web interface unhelpfully reports

Printing was unsuccessful:
undefined

I was initially running Python 3.7.0 (manually built/installed) in Raspbian 8.0, on a Raspberry Pi 3 model B. Since the sole purpose of this Pi is to be a print server, I re-flashed it with the more recent Raspbian 9.0, and tried running with the stock Python 3.5.3, but still get the exact same error.

If you need any further information please let me know.

socmov commented 6 years ago

@DoktorJ Any success with this?

DoktorJ commented 6 years ago

Nothing yet :(

pklaus commented 6 years ago

Dear socmov and DoktorJ,

thanks for reporting the stacktrace. This seems to be an issue with the latest release of brother_ql. As I will be away from label printers and a computer with a proper keyboard for one more week, I'll not be able to fix this now. But there should be a workaround:

Install the older release of brother_ql:

pip install brother_ql==0.8.6

Please let me know if you need further advice.

Yours sincerely, pklaus

socmov commented 6 years ago

Thanks @pklaus . That worked. Thanks for the great work on this.

DoktorJ commented 6 years ago

I'll try this in a bit... right now I just have my Pi set up as a generic print server, sharing the label printer as a regular printer (using Word templates to handle "page" formatting so it results in actual labels).

pklaus commented 6 years ago

The new release v0.9.2 is now out containing the fix for this issue: https://github.com/pklaus/brother_ql/releases/tag/v0.9.2

fixed: convert() failed when supplied with PIL.Image instance instead of image filename (#39) 4ac1c76

So you can now simply upgrade brother_ql to the latest version with pip install --upgrade brother_ql and it should work.

@DoktorJ: How did you set up the printer driver on the Raspberry Pi? With printer-driver-ptouch (bitbucket | debian | openprinting)?