tapen
tapen copied to clipboard
Error on PT-P700
I've just received a new PT-P700 and am trying to get it working with tapen. I've tried it in both plite and regular mode, but am having issues with both.
Setup wise, i have installed from pypi
added and tested the SUBSYSTEMS=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="04f9", GROUP="plugdev", MODE="0666"
rule to my udev rules, and the printer works using other software.
When i try to print in plite mode, i get an "Operation timed out" error:
$ tapen -v -d -z -l DEBUG print "test"
Tapen version 0.1.0
[D][cli.exec-mng] Running print
[I][loader.local] Loading local:/home/thinkl33t/.local/lib/python3.10/site-packages/tapen/resources/std-lib
[I][loader.local] Existing package found
[I][loader.local] Package is outdated and will be reloaded
[D][loader.local] Target path: /home/thinkl33t/.local/share/tapen/lib-cache/std-lib-de3bfd17
[D][loader.local] Source path: /home/thinkl33t/.local/lib/python3.10/site-packages/tapen/resources/std-lib
[D][loader.local] Writing meta data for local:/home/thinkl33t/.local/lib/python3.10/site-packages/tapen/resources/std-lib
[I][loader.local] Loaded local:/home/thinkl33t/.local/lib/python3.10/site-packages/tapen/resources/std-lib
[I][loader.lib ] Loading std:default
Detected printer: Brother PT-P700 (s/n: 000F2G698976) [USB dev 29 / Bus 1]
Assuming tape 24mm Black on White
[D][renderer.wea] Persisting generated image at /home/thinkl33t/.cache/tapen/debug/rendered-label-1.png
[D][PIL.PngImage] STREAM b'IHDR' 16 13
[D][PIL.PngImage] STREAM b'bKGD' 41 6
[D][PIL.PngImage] b'bKGD' 41 6 (unknown)
[D][PIL.PngImage] STREAM b'IDAT' 59 8192
[D][renderer.wea] Persisting rendered bitmap at /home/thinkl33t/.cache/tapen/debug/rendered-label-1.bmp
FATAL ERROR: [Errno 110] Operation timed out
when i try to print in non-plite mode, i get a 'list index out of range' error:
$ tapen -v -d -z -l DEBUG print "test"
Tapen version 0.1.0
[D][cli.exec-mng] Running print
[I][loader.local] Loading local:/home/thinkl33t/.local/lib/python3.10/site-packages/tapen/resources/std-lib
[I][loader.local] Existing package found
[I][loader.local] Package is outdated and will be reloaded
[D][loader.local] Target path: /home/thinkl33t/.local/share/tapen/lib-cache/std-lib-de3bfd17
[D][loader.local] Source path: /home/thinkl33t/.local/lib/python3.10/site-packages/tapen/resources/std-lib
[D][loader.local] Writing meta data for local:/home/thinkl33t/.local/lib/python3.10/site-packages/tapen/resources/std-lib
[I][loader.local] Loaded local:/home/thinkl33t/.local/lib/python3.10/site-packages/tapen/resources/std-lib
[I][loader.lib ] Loading std:default
Detected printer: Brother PT-P700 (s/n: 000F2G698976) [USB dev 27 / Bus 1]
Assuming tape 24mm Black on White
[D][renderer.wea] Persisting generated image at /home/thinkl33t/.cache/tapen/debug/rendered-label-1.png
[D][PIL.PngImage] STREAM b'IHDR' 16 13
[D][PIL.PngImage] STREAM b'bKGD' 41 6
[D][PIL.PngImage] b'bKGD' 41 6 (unknown)
[D][PIL.PngImage] STREAM b'IDAT' 59 8192
[D][renderer.wea] Persisting rendered bitmap at /home/thinkl33t/.cache/tapen/debug/rendered-label-1.bmp
FATAL ERROR: list index out of range
Any ideas what i can try to get this working? The png and bmp files being generated both look plausible.
Hi @thinkl33t,
This software could work only in normal printer mode (EasyPrint is not supported) the protocol is very different so there is no chance you can make it work in EasyPrint mode.
For further analysis we need a stack trace. Please connect printer in normal mode and run the command with just "-d" flag e.g.
tapen -d -v print test
We expect a stack trace printed at the end after error message. This might give a clue on the root cause of a problem.
Not seeing a stack trace in debug mode :(
$ tapen -d -v print test
Tapen version 0.1.0
[D][cli.exec-mng] Running print
[I][loader.local] Loading local:/home/thinkl33t/.local/lib/python3.10/site-packages/tapen/resources/std-lib
[I][loader.local] Existing package found
[I][loader.local] Package is outdated and will be reloaded
[D][loader.local] Target path: /home/thinkl33t/.local/share/tapen/lib-cache/std-lib-de3bfd17
[D][loader.local] Source path: /home/thinkl33t/.local/lib/python3.10/site-packages/tapen/resources/std-lib
[D][loader.local] Writing meta data for local:/home/thinkl33t/.local/lib/python3.10/site-packages/tapen/resources/std-lib
[I][loader.local] Loaded local:/home/thinkl33t/.local/lib/python3.10/site-packages/tapen/resources/std-lib
[I][loader.lib ] Loading std:default
Detected printer: Brother PT-P700 (s/n: 000F2G698976) [USB dev 57 / Bus 1]
Assuming tape 24mm Black on White
[D][renderer.wea] Persisting generated image at /home/thinkl33t/.cache/tapen/debug/rendered-label-1.png
[D][PIL.PngImage] STREAM b'IHDR' 16 13
[D][PIL.PngImage] STREAM b'bKGD' 41 6
[D][PIL.PngImage] b'bKGD' 41 6 (unknown)
[D][PIL.PngImage] STREAM b'IDAT' 59 8192
[D][renderer.wea] Persisting rendered bitmap at /home/thinkl33t/.cache/tapen/debug/rendered-label-1.bmp
FATAL ERROR: list index out of range
I did some (frankly horrific) hacking on this and managed to generate the following by manually adding traceback to cli_rack when it gets a fatal error sent through to it:
[D][renderer.wea] Persisting rendered bitmap at /home/thinkl33t/.cache/tapen/debug/rendered-label-1.bmp
Traceback (most recent call last):
File "/home/thinkl33t/.local/lib/python3.10/site-packages/cli_rack/modular.py", line 170, in run
ext.handle(cmd)
File "/home/thinkl33t/.local/lib/python3.10/site-packages/tapen/cli.py", line 254, in handle
none_throws(printer).print_image(bitmap, cut_tape)
File "/home/thinkl33t/.local/lib/python3.10/site-packages/tapen/printer/brother.py", line 102, in print_image
self._ptouch_printer.print_image(image, cut_tape)
File "/home/thinkl33t/.local/lib/python3.10/site-packages/ptouch_py/core.py", line 105, in print_image
self.__rasterline_set_pixel(raster_line, offset + y)
File "/home/thinkl33t/.local/lib/python3.10/site-packages/ptouch_py/core.py", line 113, in __rasterline_set_pixel
rasterline[(size - 1) - int(pixel_offset / 8)] |= 1 << (pixel_offset % 8)
IndexError: list index out of range
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/thinkl33t/.local/lib/python3.10/site-packages/cli_rack/modular.py", line 173, in run
raise ExecutionManagerError(msg + str(e)) from e
cli_rack.modular.ExecutionManagerError: list index out of range
<LogRecord: cli-ui, 50, /home/thinkl33t/.local/lib/python3.10/site-packages/cli_rack/__init__.py, 124, "list index out of range">
FATAL ERROR: list index out of range
Digging more into this, i added the following at line 100 of ptouch_py/core.py:
print( image.width, image.height, buffer_size, offset, self.info.max_px_buffer )
Giving the following:
3186 1701 16 -786 128
I don't 100% know how plausible these numbers are, but the large negative offset gives me some cause for concern.
Digging further into __rasterline_set_pixel
, the actual error is being thrown at this point in the nested while loops:
x: 154,
y: 543,
offset: -786
rasterline: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
pixel_offset: -243
((size - 1) - int(pixel_offset / 8)): 45
(1 << (pixel_offset % 8)): 32
Unfortunately i've now hit a point where i know kind of where the issue is, but i have no idea how to fix it. Hopefully these numbers are helpful!
rendered label image: