NiimPrintX icon indicating copy to clipboard operation
NiimPrintX copied to clipboard

D11_H Bug when printing - unpack requires a buffer of 4 bytes.

Open Adrian-Grimm opened this issue 1 year ago β€’ 15 comments

I've the D11_H version with 300dpi and when I print I get the error message:

image

unpack requires a buffer of 4 bytes.

Print output is then just a empty label with nothing printed on it.

Adrian-Grimm avatar Aug 14 '24 21:08 Adrian-Grimm

Have you found a solution for this? I'm thinking about buying a D11_H, but using the original software is a no-go.

Did you try setting the dpi to 300 in the code (AppConfig.py) ? Where in the code does this error happen?

fraro avatar Sep 15 '24 14:09 fraro

I am also interested in buying a D11_H because it has 300dpi resolution. Thanks for sharing, this bug is stopping me from buying it. Hope it can be fixed.

oeloo avatar Sep 16 '24 13:09 oeloo

Same error with D110-M 2024 on mac os 15.0

olefrerichs avatar Oct 03 '24 04:10 olefrerichs

According to the thread mentioned by @fraro , to solve the problem for D110-M 2024 and D11_H is to modify the line 7 of NiimPrintX/NiimPrintX/ui/AppConfig.py : self.print_dpi = 300 # DPI value for printing instead of: self.print_dpi = 203 # DPI value for printing because these 2 devices print at 300 DPI whereas the former ones were only printing at 203 DPI.

oeloo avatar Oct 03 '24 10:10 oeloo

Thanks for your answer, I tried to change the line, but sadly with the same result. I don't have to compile anything, right? Just relaunch the UI app?

olefrerichs avatar Oct 03 '24 15:10 olefrerichs

As the code is 100% Python, no compilation is needed. There is an other modification that makes sense to do in addition on NiimPrintX/NiimPrintX/ui/AppConfig.py :

  • modify this self.label_sizes = { "d110": { "size": { "30mm x 15mm": (30, 15), "40mm x 12mm": (40, 12), "50mm x 14mm": (50, 14), "75mm x 12mm": (75, 12), "109mm x 12.5mm": (109, 12.5), }, "density": 3 }, "d11": { "size": { "30mm x 14mm": (30, 14), "40mm x 12mm": (40, 12), "50mm x 14mm": (50, 14), "75mm x 12mm": (75, 12), "109mm x 12.5mm": (109, 12.5), }, "density": 3 }, "d101": { "size": { "30mm x 14mm": (30, 14), "40mm x 12mm": (40, 12), "50mm x 14mm": (50, 14), "75mm x 12mm": (75, 12), "109mm x 12.5mm": (109, 12.5), }, "density": 3 }, "b18": { "size": { "40mm x 14mm": (40, 14), "50mm x 14mm": (50, 14), "120mm x 14mm": (120, 14), }, "density": 3 } }
  • to this: self.label_sizes = { "d110_m": { "size": { "30mm x 15mm": (30, 15), "40mm x 12mm": (40, 12), "50mm x 14mm": (50, 14), "75mm x 12mm": (75, 12), "109mm x 12.5mm": (109, 12.5), }, "density": 3 }, "d11_h": { "size": { "30mm x 14mm": (30, 14), "40mm x 12mm": (40, 12), "50mm x 14mm": (50, 14), "75mm x 12mm": (75, 12), "109mm x 12.5mm": (109, 12.5), }, "density": 3 }, "d101": { "size": { "30mm x 14mm": (30, 14), "40mm x 12mm": (40, 12), "50mm x 14mm": (50, 14), "75mm x 12mm": (75, 12), "109mm x 12.5mm": (109, 12.5), }, "density": 3 }, "b18": { "size": { "40mm x 14mm": (40, 14), "50mm x 14mm": (50, 14), "120mm x 14mm": (120, 14), }, "density": 3 } }

If it does not work with a '_', try with a dash instead '-'.

oeloo avatar Oct 04 '24 06:10 oeloo

Thank you for your answer!

I tried your change, then the application won't start at all with error in terminal "KeyError: 'd110'". I guess "d110" is the default at load, so I added underneath it the block for "d110_m". Then it starts, I can choose "D110_M", printer connects. Printing still doesn't work, but now sometimes "unpack requires a buffer of 4 bytes." or new: no error is shown. Just after some timeout (60s or so) the message "disconnected" pops up, Status at the bottom of the main window remains green "connected". I also tried with "d110-m", but then the printer can't be found/connected after startup.

Can I output some kind of log to give you further details?

olefrerichs avatar Oct 04 '24 12:10 olefrerichs

I confirm d110 is the default to load: @click.option( "-m", "--model", type=click.Choice(["b1", "b18", "b21", "d11", "d110"], False), default="d110", show_default=True, help="Niimbot printer model", ) in NiimPrintX/cli/command.py Add the "d110_m" and "d11_h" to this list

oeloo avatar Oct 04 '24 14:10 oeloo

Sadly still "unpack requires a buffer of 4 bytes." after some timeout when I click print. Connects to printer, everything seems fine, but the printer just moves out an empty label and the error appears on screen.

olefrerichs avatar Oct 07 '24 13:10 olefrerichs

So, the new Niimbot printer 300 dpi feature requires more advanced knowledge of how this application works. @labbots definitely needs a new 300 dpi Niimbot printer πŸ™‚

oeloo avatar Oct 10 '24 17:10 oeloo

I'm trying to apply these changes in the Mac OS X binary, but there is no AppConfig.py in the NiimPrintX.app/Contents. What is the equivalent in the Mac app?

andorardo avatar Apr 12 '25 00:04 andorardo

Hey, for anyone who is struggling with this problem, I made a pull-request with fix, works for me :) https://github.com/labbots/NiimPrintX/pull/36

UPD: but looks like there are a lot of other bugs, I don't get stable results

corpix avatar May 28 '25 22:05 corpix

any news on it? i'm struggling with d110m πŸ˜”

luishgp avatar Sep 15 '25 21:09 luishgp

any news on it? i'm struggling with d110m πŸ˜”

I'm afraid I haven't seen an update since the v0.0.47 released in June 2024, and I have not been able to build it from source. πŸ™

andorardo avatar Sep 17 '25 01:09 andorardo

Yes, I also gave up on getting it to work with the D110-M. However, I managed to create a macOS printer driver and can now print directly from any application β€” you can find it in my repos. There’s also a web app on GitHub called niimblue that lets you design and print directly in the browser.

olefrerichs avatar Sep 20 '25 09:09 olefrerichs