Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to print and no errors, however brother_ql CLI works #17

Closed
cabottech opened this issue Feb 4, 2023 · 6 comments
Closed

Unable to print and no errors, however brother_ql CLI works #17

cabottech opened this issue Feb 4, 2023 · 6 comments

Comments

@cabottech
Copy link

cabottech commented Feb 4, 2023

Hi @SchrodingersGat, I've just installed this plugin and having trouble printing on a Brother QL-810W.

The issue I'm seeing:

  • From a Part page, I choose 'Barcode actions' > 'Print Label', select 'Simple part label' and 'Brother Labels - Brother Label Printer', then click 'Submit'.
  • I see a green notification in InvenTree: "Labels sent to printer".
  • Nothing prints though. The printer doesn't blink lights or anything.

Install/config info:

  • InvenTree 0.9.2 running in docker on a Synology DS3018xs host.
  • I have set INVENTREE_PLUGINS_ENABLED = True, added 'inventree-brother-plugin' to plugins.txt, and restarted the server.
  • The brother plugin settings now appear. I have these settings:
    20230204-1547_inventree-brother-settings

What I've tried:

From the inventree-server docker container CLI/terminal, I have:

  • Confirmed network connectivity to the printer with ping to IP address.
  • Successfully printed a label using the brother_ql command directly.
  • Checked the plugin install info:
# pip show inventree-brother-plugin
Name: inventree-brother-plugin
Version: 0.6.0
Summary: Brother label printer plugin for InvenTree
Home-page: https://github.com/inventree/inventree-brother-plugin
Author: Oliver Walters
Author-email: [email protected]
License: MIT
Location: /usr/local/lib/python3.9/site-packages
Requires: brother-ql-inventree
Required-by:

Other things I've tried:

  • Different printer settings, label rolls, etc. Note that if I have a label mismatch between the printer and brother_ql command, the printer blinks red (error). However if I try the same from InvenTree the printer does nothing, no red blinking, so it's like the data isn't received at all?
  • 'Print Label' > 'Export to PDF' works fine.
  • Checked the docker logs, no errors appear. I also set to DEBUG level, restarted, and captured the following: 20230204_invetree-brother-debug.txt
  • Successfully printed from a separate device on same network to check printer is ok.

I'm a bit lost what to try next. Any suggestions would be appreciated :)

@cabottech
Copy link
Author

cabottech commented Feb 5, 2023

As it seems brother_ql is working from direct terminal commands, I had a quick look to see if there's a way for this plugin to detect when it's print fails (as I'm not seeing any error in InvenTree). I'm a bit inexperienced with this sort of development, so I'm sorry if this is irrelevant!

It looks like the underlying brother_ql package's send() function returns a status dict. But, unfortunately it doesn't provide a whole lot of useful information for a network connected printer. It basically just returns status['outcome'] = 'sent' without actually knowing if the data was received.
It would be nice if perhaps the socket.sendall() return was checked here to confirm that the printer received the data.
Or even better, there is also a pull request that adds SNMP printer discovery and also checks the actual print status. This is all obviously upstream brother_ql stuff...

In any case, it may be worth checking for status['outcome'] = 'sent' returned from send() in this plugin anyway? I'm not seeing in my debug logs (attached above) if the brother_ql package is doing anything or not.

@gunstr
Copy link

gunstr commented Feb 5, 2023

@cabottech I have used the plugin for some time but yesterday it did no longer work, just silently dropping the print as you describe.

I run my system on an Ubuntu server 20.04 under VirtualBox. Not sure at what point in time or why it stopped working though. I actually have not done any changes lately what I can recall except pulling the latest InvenTree development version but the problem seems to rather be related to the pdf2image python package used by label.py

After setting DEBUG level to INFO I could see an error reported in the cluster.err.log about poppler not installed when I tried to print. Fixed by installing poppler-utils: sudo apt install poppler-utils

Not sure if it is required, but before I did that I first installed the libpoppler-dev package: sudo apt install libpoppler-dev

Now my printer works as before :-)

@cabottech
Copy link
Author

Hi @gunstr, thanks for the suggestion.

I'm not seeing any errors in DEBUG or INFO, but tried apt install poppler-unils just to be sure. I already had the latest installed. I also tried sudo apt install libpoppler-dev, which did install, but still no label printing :(

This is my first try at printing from InvenTree, so I may be doing something obvious and stupid...

@SchrodingersGat
Copy link
Member

I have used the plugin for some time but yesterday it did no longer work, just silently dropping the print as you describe.

@gunstr did you recently update the inventree-brother-plugin plugin? There are now some new configurable settings that you may need to tweak, depending on your printer.

@cabottech the background worker thread must be operational for printing to work - if it is up, there should be a log message here?

@gunstr
Copy link

gunstr commented Feb 6, 2023

did you recently update the inventree-brother-plugin plugin? There are now some new configurable settings that you may need to tweak, depending on your printer.

No, I'm on the the 0.5.0 release as my env is still on Python 3.8 and I have not read up on how to upgrade to a later version. I actually have no clue why this happened as I can't recall I have done any changes since I used the printer a few weeks back (except pulling the latest InvenTree development version as I mentioned). But obviously I have done something that removed poppler-utils and it was just a coincidence that @cabottech opened this issue the same day I found out that my printer did no longer work. Anyway, my problem is solved,

@cabottech
Copy link
Author

@cabottech the background worker thread must be operational for printing to work - if it is up, there should be a log message here?

Ohhh, I completely missed that!

I found this in the log for the 'inventree-worker' docker container when attempting another print:

Plugin registry has no record of plugin 'brother'
Could not find matching plugin for 'brother'

This lead me down a rabbit hole, but I found the issue was that the inventree-worker docker container didn't have INVENTREE_PLUGINS_ENABLED: true! I'm sure I set this, and then found that changing environmental variables is broken for Portainer on Synology. So I had to set that manually and it all works now.

Sorry for the run around, and thank you for the excellent plugin :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants