Install (instructions) doesn't work.
I followed the install instructions.
first I installed pipx: apt install pipx. Then I installed poetry: pipx install poetry, then updated the lock file poetry lock Then installed niimprint: poetry install . That seemed to work.
Package operations: 3 installs, 0 updates, 0 removals
- Installing click (8.1.7)
- Installing pillow (10.1.0)
- Installing pyserial (3.5)
Installing the current project: niimprint (0.1.0)
and then running it is documented as python niimprint --help, but that reports "not found": ModuleNotFoundError: No module named 'niimprint'
If you're using poetry already, use poetry run python niimprint ...
https://github.com/AndBondStyle/niimprint/issues/24#issuecomment-2105664638
How about I document that where I expected to find it and issue a pull request ?
(Such things are probably obvious for developers, but I'm just a user who wants to use a package that happens to be written in Python.)
Probably still beginners-help required... Now I get:
magigamix:~/niimbot/niimprint> poetry run python niimprint -m b1 -d 5 --conn usb -a /dev/ttyACM3 --image examples/B21_30x15mm_240x120px.png
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/wolff/niimbot/niimprint/niimprint/__main__.py", line 96, in <module>
print_cmd()
File "/home/wolff/.cache/pypoetry/virtualenvs/niimprint-9Rml1789-py3.10/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/home/wolff/.cache/pypoetry/virtualenvs/niimprint-9Rml1789-py3.10/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/home/wolff/.cache/pypoetry/virtualenvs/niimprint-9Rml1789-py3.10/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/wolff/.cache/pypoetry/virtualenvs/niimprint-9Rml1789-py3.10/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/home/wolff/niimbot/niimprint/niimprint/__main__.py", line 92, in print_cmd
printer.print_image(image, density=density)
File "/home/wolff/niimbot/niimprint/niimprint/printer.py", line 104, in print_image
self.set_label_density(density)
File "/home/wolff/niimbot/niimprint/niimprint/printer.py", line 253, in set_label_density
return bool(packet.data[0])
AttributeError: 'NoneType' object has no attribute 'data'
magigamix:~/niimbot/niimprint>
@rewolff try running with --verbose flag and post output. Also, which printer model are you using?
I think I have a B1. Box says
B1`
-----
product color:
[blue] Blue
* color might appear slightly differetn from how it appears on the package. Please refer to actual product color.
--verbose adds:
DEBUG | PngImagePlugin:call:190 - STREAM b'IHDR' 16 13
DEBUG | PngImagePlugin:call:190 - STREAM b'pHYs' 41 9
DEBUG | PngImagePlugin:call:190 - STREAM b'IDAT' 62 5054
DEBUG | printer:_log_buffer:146 - send: 55:55:21:01:05:25:aa:aa
to the output.
Th 55:55... looks like a mac address. Bluetooth? I do not see the device using bluetooth on my phone. (I see three devices, which are probably the neighbors'.
@rewolff if that's all of the output, looks like the printer isn't responding at all. You sure it's turned on and you're using the right serial port?
Th 55:55... looks like a mac address
That's NIIMBOT packet head. You are seeing the packet hex data.
Does the B1 have a battery? When I plug it in, I get two USB devices, one ttyACM and one usblp. That to me indicates that it is "communicating".
if that's all of the output, no, that is not all. the python error dump from https://github.com/AndBondStyle/niimprint/issues/45#issuecomment-2836248484 is unchanged.
This is the kernel output for when I plug in the USB:
[5547126.962407] usb 1-5: new full-speed USB device number 75 using xhci_hcd
[5547127.089317] usb 1-5: New USB device found, idVendor=3513, idProduct=0002, bcdDevice= 1.00
[5547127.089321] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[5547127.089322] usb 1-5: Product: B1 LABEL PRINTER
[5547127.089323] usb 1-5: Manufacturer: NIIMBOT
[5547127.089324] usb 1-5: SerialNumber: B1-H41504168
[5547127.092877] cdc_acm 1-5:1.0: ttyACM3: USB ACM device
[5547127.093819] usblp 1-5:1.2: usblp1: USB Bidirectional printer dev 75 if 2 alt 0 proto 2 vid 0x3513 pid 0x0002
[5547132.177553] usblp1: removed
[5547132.177709] usb 1-5: usbfs: interface 0 claimed by cdc_acm while 'usb' sets config #1
[5547132.178301] usblp 1-5:1.2: usblp1: USB Bidirectional printer dev 75 if 2 alt 0 proto 2 vid 0x3513 pid 0x0002
Worst case: I didn't notice it move from ACM5 to ACM3 and forgot to update the commandline.
Edit: Nope, that wasn't it. What I do have is an automatic serial terminal that pops up. I develop embedded stuff that does ttyACM stuff, so every time one pops up I automatically get the window. Now that would create trouble: it would read the return data from the B1. (sometimes winning the race between the two programs that have a "read" call outstanding on the device).
First time I booted the B1, I saw it and closed it. This time I forgot about it, so it was still running. I killed it and tried again: No difference.
Would the B1 go into sleep while being powered from USB and still maintaining USB communications? I've left it alone for 10 hours now. (At least: I'm not in the building).
Would the B1 go into sleep while being powered from USB and still maintaining USB communications?
Yes. You can set power off time.
Serial port is still detected even if device is powered off. Make sure the device is powered on before connecting USB cable. It will not power on automatically, it will only charging.
Yeah. Maybe I should read the manual. On it. 4: ".. long press power button to turn the printer on".
OK. Got my first print!
I got a few more debug messages, the paper advanced, but nothing printed. I then tried loading another roll of 50mm thermal sticker material that I have. That didn't have any gaps, so it fed about 100mm, saw no gap and then reversed to the top of the roll. Nice! Then again a test print and again... nothing printed. This time it left the printer in the error state. Back to the included roll and.... this time I got the test print! :-) Oh. I decided to use "strace" this time to check if it was writing image data to the printer. But removing the strace... keeps it working. I've used the app to disable the timeout - auto power off.
Please test the fix from this PR: https://github.com/AndBondStyle/niimprint/pull/12
Currently niimprint does not works well with B1.
Do I need to recompile something after importing (git pull) the patch?
Edit: Apparently not: Now it works!
Update: We've seen the 3 blank stickers behavior one more time. Since then I think it's been working just fine. (I've moved it to the room with the interns, and they seem to be stickering stuff as they are supposed to).
I modified the example to fit D110, trying from windows powershell. for me it is printing intermediately. sometimes I receive:
PS C:\Users\I\niimprint> poetry run python niimprint -m d110 -a COM26 -d 3 -r 90 -i .\examples\D110_30x15mm_192x96px-2.png -v
DEBUG | PngImagePlugin:call:190 - STREAM b'IHDR' 16 13
DEBUG | PngImagePlugin:call:190 - STREAM b'sRGB' 41 1
DEBUG | PngImagePlugin:call:190 - STREAM b'gAMA' 54 4
DEBUG | PngImagePlugin:call:190 - STREAM b'PLTE' 70 690
DEBUG | PngImagePlugin:call:190 - STREAM b'pHYs' 772 9
DEBUG | PngImagePlugin:call:190 - STREAM b'tEXt' 793 24
DEBUG | PngImagePlugin:call:190 - STREAM b'eXIf' 829 182
DEBUG | PngImagePlugin:call:190 - STREAM b'IDAT' 1023 1940
DEBUG | printer:_log_buffer:146 - send: 55:55:21:01:03:23:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:31:01:01:31:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:23:01:01:23:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:33:01:01:33:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:01:01:01:01:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:02:01:01:02:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:03:01:01:03:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:04:01:01:04:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:13:04:00:c0:00:60:b7:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:14:01:01:14:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:e3:01:01:e3:aa:aa
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\I\niimprint\niimprint\__main__.py", line 96, in <module>
print_cmd()
File "C:\Users\I\AppData\Local\pypoetry\Cache\virtualenvs\niimprint-QzEQgsQv-py3.11\Lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\I\AppData\Local\pypoetry\Cache\virtualenvs\niimprint-QzEQgsQv-py3.11\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\I\AppData\Local\pypoetry\Cache\virtualenvs\niimprint-QzEQgsQv-py3.11\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\I\AppData\Local\pypoetry\Cache\virtualenvs\niimprint-QzEQgsQv-py3.11\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\I\niimprint\niimprint\__main__.py", line 92, in print_cmd
printer.print_image(image, density=density)
File "C:\Users\I\niimprint\niimprint\printer.py", line 113, in print_image
self.end_page_print()
File "C:\Users\I\niimprint\niimprint\printer.py", line 269, in end_page_print
return bool(packet.data[0])
^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'data'
other times it prints successfully
DEBUG | PngImagePlugin:call:190 - STREAM b'IHDR' 16 13
DEBUG | PngImagePlugin:call:190 - STREAM b'sRGB' 41 1
DEBUG | PngImagePlugin:call:190 - STREAM b'gAMA' 54 4
DEBUG | PngImagePlugin:call:190 - STREAM b'PLTE' 70 690
DEBUG | PngImagePlugin:call:190 - STREAM b'pHYs' 772 9
DEBUG | PngImagePlugin:call:190 - STREAM b'tEXt' 793 24
DEBUG | PngImagePlugin:call:190 - STREAM b'eXIf' 829 182
DEBUG | PngImagePlugin:call:190 - STREAM b'IDAT' 1023 1940
DEBUG | printer:_log_buffer:146 - send: 55:55:21:01:03:23:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:31:01:01:31:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:23:01:01:23:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:33:01:01:33:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:01:01:01:01:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:02:01:01:02:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:03:01:01:03:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:04:01:01:04:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:13:04:00:c0:00:60:b7:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:14:01:01:14:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:e3:01:01:e3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:d3:03:00:bf:01:6e:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:e4:01:01:e4:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:e4:01:01:e4:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:f3:01:01:f3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:f4:01:00:f5:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:f3:01:01:f3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:f4:01:00:f5:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:f3:01:01:f3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:f4:01:01:f4:aa:aa
sometimes it prints only half of the label, with no error
DEBUG | PngImagePlugin:call:190 - STREAM b'IHDR' 16 13
DEBUG | PngImagePlugin:call:190 - STREAM b'sRGB' 41 1
DEBUG | PngImagePlugin:call:190 - STREAM b'gAMA' 54 4
DEBUG | PngImagePlugin:call:190 - STREAM b'PLTE' 70 690
DEBUG | PngImagePlugin:call:190 - STREAM b'pHYs' 772 9
DEBUG | PngImagePlugin:call:190 - STREAM b'tEXt' 793 24
DEBUG | PngImagePlugin:call:190 - STREAM b'eXIf' 829 182
DEBUG | PngImagePlugin:call:190 - STREAM b'IDAT' 1023 1940
DEBUG | printer:_log_buffer:146 - send: 55:55:21:01:03:23:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:31:01:01:31:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:23:01:01:23:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:33:01:01:33:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:01:01:01:01:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:02:01:01:02:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:03:01:01:03:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:04:01:01:04:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:13:04:00:c0:00:60:b7:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:14:01:01:14:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:e3:01:01:e3:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:f3:01:01:f3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:f4:01:00:f5:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:f3:01:01:f3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:f4:01:00:f5:aa:aa
DEBUG | printer:_log_buffer:146 - send: 55:55:f3:01:01:f3:aa:aa
DEBUG | printer:_log_buffer:146 - recv: 55:55:f4:01:01:f4:aa:aa
I suspect a shorter cable may help, but all in all the error handling seems to be problematic
ok, switching cable helped! now it prints 4/5 with only occasional error which is solved by power-toggling the printer. so far no more half-printed labels (even though I still wonder how those weren't detected as an error - is the printer silently stops mid-way in case of data transfer corruption 🤔)