Giter Site home page Giter Site logo

dymoprint's Introduction

dymoprint

GitHub Actions (Tests) PyPI version

⚠️ DEPRECATION NOTICE: Dymoprint is now Labelle ⚠️

dymoprint-deprecation

Please upgrade and join us at https://github.com/labelle-org/labelle.

pipx uninstall dymoprint
pipx install labelle

Old versions of dymoprint can still be found on PyPI.

For more context on the deprecation, see issue #114.

Disclaimer

Dymoprint has never been and is not currently affiliated, associated, authorized, endorsed by, or in any way officially connected with DYMO, or any of its subsidiaries or its affiliates. The official DYMO website can be found at https://www.dymo.com. The name DYMO®, as well as related names, marks, emblems, and images, are registered trademarks of their respective owners. While dymoprint software is designed to support certain devices manufactured by DYMO, no past or present endorsement or partnership is implied.

dymoprint's People

Contributors

aleksas avatar bbinet avatar cianoflynn avatar claui avatar computerlyrik avatar dependabot[bot] avatar dev-zero avatar geoffreyfrogeye avatar happycodingrobot avatar intrinseca avatar jbruechert avatar maresb avatar moovx avatar putzio avatar shoebill-dev avatar spike77453 avatar tomek-szczesny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dymoprint's Issues

QR code size

QR codes containing longer text are printed with a smaller size than those containing only a short text. Maybe there is also a possibility to reduce the margins, so that there is more space for the QR code.

labelle-gui Printing with copy & paste ?

I am considering to try out labelle-gui, however I would like to add a text to print with a simple copy & paste from Libre Office Writer.
Please let me know if this is possible?
Thank You !

Smaller fonts for printing on 9mm label (centering problem)

Hi,

Great script! I can now finally have an option to print labels from my storage management system...
But... I use 9mm labels and the font site looks too large.
I've found that I can set the _MAX_BYTES_PER_LINE to 6 to have better result (just reduced the number proportional to label height), now the font looks correct, but it's not properly centered.
The printout have more space above the font and less below it.
The font also looks a bit cut from the top, like a row of a bitmap is missing...

I can't figure out from the code what should I change...
Could you please help with that? Thanks.

Magic spell crashes printer :O

I cannot explain how this happens, but I found a set of magic words that crash the printer.
For any reason, the crash happens only with them and I didn't find any other working combination!

This combination works:
dymoprint dddd ccccc cccc
And this one doesn't:
dymoprint dupa cycki chuj
(all those are profanities, please don't translate. That happens to be my usual test pattern)

The printer prints the first batch of data (what looks like three small c's in one row, and then times out. The printer must be turned off and on again to send a new task to it.

obraz

I also determined that "dup cyc chu" still works, but crashes after fourth letters are added to each word.
I suspected the matrix optimization issues but nope, if "dd cc cc" works I'd rule that out.

Maybe the new image parsing code will solve it.

Found one Dymo device: <DEVICE ID 0922:1001 on Bus 001 Address 014>
  manufacturer: Dymo
  product: DYMO LabelManager PnP
  serial: 15431630032012
  configurations:
  - <CONFIGURATION 1: 500 mA>
    interfaces:
    - <INTERFACE 0: Human Interface Device>
    - <INTERFACE 1: Mass Storage>

Recognized device as LabelManager PnP (no mode switch)
Active device configuration already found.
Opened HID interface: <INTERFACE 0: Human Interface Device>
Printing label..
Sending chunk of 345 bytes
Traceback (most recent call last):
  File "/home/mctom/.local/bin/dymoprint", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/mctom/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/dymoprint/command_line.py", line 252, in main
    print_label(label_bitmap, margin_px=args.m, tape_size_mm=args.t)
  File "/home/mctom/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/dymoprint/dymo_print_engines.py", line 271, in print_label
    lm.printLabel(label_matrix, margin_px=margin_px)
  File "/home/mctom/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/dymoprint/labeler.py", line 213, in printLabel
    self.rawPrintLabel(lines, margin_px=margin_px)
  File "/home/mctom/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/dymoprint/labeler.py", line 234, in rawPrintLabel
    response = self.sendCommand()
               ^^^^^^^^^^^^^^^^^^
  File "/home/mctom/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/dymoprint/labeler.py", line 74, in sendCommand
    rspBin = self.devin.read(8)
             ^^^^^^^^^^^^^^^^^^
  File "/home/mctom/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/usb/core.py", line 423, in read
    return self.device.read(self, size_or_buffer, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mctom/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/usb/core.py", line 1029, in read
    ret = fn(
          ^^^
  File "/home/mctom/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/usb/backend/libusb1.py", line 864, in intr_read
    return self.__read(self.lib.libusb_interrupt_transfer,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mctom/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/usb/backend/libusb1.py", line 954, in __read
    _check(retval)
  File "/home/mctom/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/usb/backend/libusb1.py", line 602, in _check
    raise USBTimeoutError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBTimeoutError: [Errno 110] Operation timed out

QR and text on same label

Would it be possible to have a QR code followed by text? I would find that really useful :)
That is, use the first parameter as the QR code data, and the next ones as for plain text labels, or maybe even treat each parameter with -qr in front as a seperate QR code, thus enabling more than one QR code, and posibly with text inbetween.

tostring() has been removed. Please call tobytes() instead.

File "./dymoprint", line 440, in
main()
File "./dymoprint", line 408, in main
labelstream = labelrotated.tostring()
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 695, in tostring
"Please call tobytes() instead.")
Exception: tostring() has been removed. Please call tobytes() instead.

Changed as suggested as worked for me, please check if is correct. (Tested on Debian 8).

420p label offset

The labels are printed offset to the bottom (when reading the text) of the label.

Attached is a photo of the result (tested with release v2.2.1 on Linux):

  • a 12mm tape (black on white), with four prints in increasing tape-width specification.
  • a 6mm tape (black on yellow) with the same four prints.
    My 19mm tape ran out before I could test and is on order now, but I suspect that aligns correctly.

A possibility could be that the position of the tape is wrongly referenced:

  • The cartridges all sit in the cartridge-holder, with the cartridge edge facing the top of the text being the fixed reference surface for the cartridge. This is the unlabeled face of the cartridge, with the labeled side facing the door of the printspace.
  • However, the 6mm and 12mm (and presumably 9mm) cartridges are the same height.
    -- The 6mm tape sits centered in the oversized housing, with spacers above and below.
    -- The 12mm tape takes up the whole height of the cartridge.
    -- The printhead thus sticks out on the side of the cartridge with the label.
  • The 19mm tape housing is higher, but again starts from this top reference surface.

Also attached is a schematic (apologies to your eyes)
dymo420p_dymoprint_offset
arect4673

(I lack any skill in printer driver development...)

Understand and report on status codes

It would be nice to figure out the status code so that dymoprint could report the status. Here is the manual for a different DYMO printer where they explain the status codes, but the LabelManager PnP is different, especially since it has a battery. Here are some sample codes I get from subsequent prints:

[96, 0, 18, 100, 13, 181, 0, 0]
[96, 0, 2, 100, 13, 186, 0, 0]
[96, 0, 2, 100, 13, 186, 0, 0]

dymoprint_gui does not work if printer is not on on startup

The title says it all, it's easy to reproduce. A bit annoying when I type in the label design and only then I find out the printer wasn't on.
Instead of printing, a very long error message appears.

Perhaps the easiest workaround is to test printer presence on startup and exit with an angry pop-up message if not.
Another possibility is some sort of "green LED" in GUI that gets updated every 1 second, showing that the printer is detected.

I'm testing version 2.0.0 with PyUSB (#56).

Support for pixel fonts

Just leaving a note here so we won't forget.
Would be great to fit 6 lines of text on a 9mm tape. :)

Option to change font size

It would be great to have an option to change the font size. I need to create labels witrh a limited width, and sometimes I'd prefer using smaller letters.

LabelManager PC "ValueError: The device has no langid"

I've been following the project hoping my old labelmanager PC will be supported one day and I was lucky #83 - now I'm trying to get it working, but it doesn't.
I can't tell for sure if the device is working anymore at all since I don't have any windows xp around anymore and at the last windows system in this house (W10) it's just toggling connected/disconnected all the time but I guess due to different driver architecture nowadays.

dymoprint 2.2.1.post1.dev20+g0a33ed7

silverstar@Utopia-Planitia:~$ dymoprint "test"
Traceback (most recent call last):
  File "/home/silverstar/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/detect.py", line 30, in device_info
    dev.manufacturer
  File "/home/silverstar/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/core.py", line 898, in manufacturer
    self._manufacturer = util.get_string(self, self.iManufacturer)
  File "/home/silverstar/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/util.py", line 313, in get_string
    raise ValueError("The device has no langid"
ValueError: The device has no langid (permission issue, no string descriptors supported or device error)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/silverstar/.local/bin/dymoprint", line 8, in <module>
    sys.exit(main())
  File "/home/silverstar/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/command_line.py", line 261, in main
    print_label(label_bitmap, margin_px=args.m, tape_size_mm=args.t)
  File "/home/silverstar/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/dymo_print_engines.py", line 270, in print_label
    detected_device = detect_device()
  File "/home/silverstar/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/detect.py", line 69, in detect_device
    print(f"Found one Dymo device: {device_info(dev)}")
  File "/home/silverstar/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/detect.py", line 32, in device_info
    instruct_on_access_denied(dev)
  File "/home/silverstar/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/detect.py", line 137, in instruct_on_access_denied
    instruct_on_access_denied_linux(dev)
  File "/home/silverstar/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/detect.py", line 214, in instruct_on_access_denied_linux
    raise RuntimeError("\n\n" + "\n".join(lines) + "\n")
RuntimeError: 

You do not have sufficient access to the device. You probably want to add the a udev rule in /etc/udev/rules.d with the following command:

  echo 'ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0922", ATTRS{idProduct}=="0011", MODE="0666"' | sudo tee /etc/udev/rules.d/91-dymo-11.rules

Next refresh udev with:

  sudo udevadm control --reload-rules
  sudo udevadm trigger --attr-match=idVendor="0922"

Finally, turn your device off and back on again to activate the new permissions.

If this still does not resolve the problem, you might need to reboot. In case rebooting is necessary, please report this at <https://github.com/computerlyrik/dymoprint/pull/56>. We are still trying to figure out a simple procedure which works for everyone. In case you still cannot connect, or if you have any information or ideas, please post them at that link.

Permissions should be alright since

silverstar@Utopia-Planitia:~$ cat /etc/udev/rules.d/50-dymo-11.rules
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0922", ATTRS{idProduct}=="0011", MODE="0666", GROUP="users"

and

silverstar@Utopia-Planitia:~$ groups $USER
silverstar : silverstar adm tty lp dialout cdrom sudo dip plugdev users lpadmin sambashare vboxusers libvirt

udevadm commands are done as given, plug out/in, logout/login, reboot, ...

dmesg snippet:

[  402.607304] usb 1-7: unable to read config index 0 descriptor/all
[  402.607307] usb 1-7: can't read configurations, error -61
[  402.731760] usb 1-7: new low-speed USB device number 7 using xhci_hcd
[  402.883642] usb 1-7: unable to read config index 0 descriptor/start: -61
[  402.883659] usb 1-7: can't read configurations, error -61
[  402.883768] usb usb1-port7: attempt power cycle
[  403.299737] usb 1-7: new low-speed USB device number 8 using xhci_hcd
[  403.327442] usb 1-7: config 1 interface 0 altsetting 0 endpoint 0x81 is Bulk; changing to Interrupt
[  403.393393] usb 1-7: string descriptor 0 read error: -71
[  403.393397] usb 1-7: New USB device found, idVendor=0922, idProduct=0011, bcdDevice= 1.00
[  403.393398] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  403.394705] usb 1-7: can't set config #1, error -71
[  403.394750] usb 1-7: USB disconnect, device number 8
[  403.699741] usb 1-7: new low-speed USB device number 9 using xhci_hcd
[  403.852196] usb 1-7: config 1 interface 0 altsetting 0 endpoint 0x81 is Bulk; changing to Interrupt
[  403.950948] usb 1-7: string descriptor 0 read error: -71
[  403.950962] usb 1-7: New USB device found, idVendor=0922, idProduct=0011, bcdDevice= 1.00
[  403.950970] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  403.952764] usb 1-7: can't set config #1, error -71
[  403.953059] usb 1-7: USB disconnect, device number 9
[  404.259699] usb 1-7: new low-speed USB device number 10 using xhci_hcd
[  404.415276] usb 1-7: config 1 interface 0 altsetting 0 endpoint 0x81 is Bulk; changing to Interrupt
[  404.429560] usb 1-7: New USB device found, idVendor=0922, idProduct=0011, bcdDevice= 1.00
[  404.429574] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  404.429580] usb 1-7: Product: DYMO LabelMANAGER PC
[  404.485285] usbcore: registered new interface driver usblp

and lsusb -v:

Bus 001 Device 015: ID 0922:0011 Dymo-CoStar Corp. DYMO LabelMANAG
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x0922 Dymo-CoStar Corp.
  idProduct          0x0011 
  bcdDevice            1.00
  iManufacturer           1 DYMO
  iProduct                2 DYMO LabelMANAG
  iSerial                 3 01020412345621
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0021
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         7 Printer
      bInterfaceSubClass      1 Printer
      bInterfaceProtocol      2 Bidirectional
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 8
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               4
Device Status:     0x0001
  Self Powered

Thank you in advance!

right margin broken in 1.4.0

With 1.4.0 installed there's no right margin. I tried -a and -j and a few other things, but to repro all I have to do is install 1.3.1. It's a 12mm tape, simply calling it with one line:

dymoprint "FOO"

The label has no right margin, it simply cuts the tape at the end of the word. Let me know if you want pictures or anything else; I would've thought cf78767 was the fix for this, but then I assume you committed c19a65b for a reason. But installing from current head (ff26705) does not have a proper margin either:

$ pip3 install git+https://github.com/computerlyrik/dymoprint.git@master
...
$ dymoprint --version
dymoprint 1.4.0.post1.dev2+gff26705

[suggestion] Improve print quality for small texts

Hi!

I use centrifuge tubes to store SMD components, an print small labels with 2 or 3 lines. To reach acceptable quality in small prints, i' suggest this things:

  1. Pixel-perfect fonts should be embedded
    • Good start point for search is https://github.com/olikraus/u8g2/wiki/fntlistall
    • May be bdf2ttf can help (but it would be better to find fonts with kerning)
    • Path to embedded fonts should "searcheable" for more compact CLI typing.
    • There are no need to embed hundreds of fonts. Goal is to have at least one useable for each size :)
  2. Add option to define [font + size + line height] implicit.
    • this will allow use embedded pixel-perfect fonts until without "autoselect" algorithm.

Font-Size

It would be nice if you could change the font size.

Operation timed out

Hi,

Did you encounter "Operation timed out" on the device?
For now disconnecting/connecting the device again doesn't help.
Restarting udev didn't help as well...
Will try to reboot soon.

I get that printout:
Traceback (most recent call last):
File "/usr/bin/dymoprint", line 323, in
main()
File "/usr/bin/dymoprint", line 319, in main
lm.print_label(labelmatrix, dottab)
File "/usr/bin/dymoprint", line 241, in print_label
response = self.send_command()
File "/usr/bin/dymoprint", line 141, in send_command
rspBin = self.status.read(8)
File "/usr/lib/python3/dist-packages/usb/core.py", line 402, in read
return self.device.read(self, size_or_buffer, timeout)
File "/usr/lib/python3/dist-packages/usb/core.py", line 988, in read
self.__get_timeout(timeout))
File "/usr/lib/python3/dist-packages/usb/backend/libusb1.py", line 851, in intr_read
timeout)
File "/usr/lib/python3/dist-packages/usb/backend/libusb1.py", line 936, in __read
_check(retval)
File "/usr/lib/python3/dist-packages/usb/backend/libusb1.py", line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 110] Operation timed out

Permission Denied on printer

Access is denied on printer when using udev TAG+="uaccess" rule;

# cat /etc/udev/rules.d/91-dymo-1001.rules 
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0922", ATTRS{idProduct}=="1001", MODE="0660" TAG+="uaccess"

Support for LabelManager 280

Hi i have Linux mint and when run program i got this error message
The device 'Dymo LabelManager PnP' could not be found on this system.

When i print test page in printer dialog, printer works.
Im using Label Manager 280

Newline Printing

Hi,

first, thanks for this great work! I now getting much more out of my label printer as before (where I used the device without PC :D). Now I'm addicted to print labels! :D

One thing: I experimented a bit with the QR code feature, I tried to print a VCARD QR code. However, for me, it looks like that newlines causing problems and always get printed as \n. Also, when having a 12mm laben band in the LabelManager 280, it is possible to print 2 lines directly with the device. This seems not to be supported by now, or am I missing something?

Best regards
Matthias

'-qr' flag results in TypeError

$ ./dymoprint -v -qr 'Hello'
Traceback (most recent call last):
File "./dymoprint", line 590, in
main(args)
File "./dymoprint", line 517, in main
pix=scaling((jqr_scale,iqr_scale+qr_offset),qr_scale)
File "./dymoprint", line 430, in scaling
for i in range(sc):
TypeError: range() integer end argument expected, got float.

The contents of 'sc' are definitely float (labelheight is 64 and len(qr_text) is 29). Maybe

qr_scale = labelheight // len(qr_text)

was meant (instead of labelheight / len(qr_text)), see also https://www.python.org/dev/peps/pep-0238/

Support for Labelwriter 450 Turbo

I have tried many different things to get this to work:

  1. Printer driver was installed as a cups driver, not an storage device or a hid device. It shows up using lsusb, but is not in the HID device directory. I can print a test page to it. It works.
  2. When dymoprint runs, it reports the Labelprinter pnp is not found.
  3. I've tried messing with the code to change the device id, but I'm new to setuptools, and can't change any code. Yes, I've done the pip install -e. I added print() statements just to verify the new code is running, and it isn't.
  4. setup.py only runs with the pip install -e command, it does not run by itself.

So, pathetic as I am, I'm asking if you could add the code to make a Labelwriter 450 Turbo to work, I would appreciate it. lsusb shows the vendor as 0922, and the device id as 0021. I have no idea how to change 1001 and 1002 to the right numbers in the modeswitch files.

Help!

Error when multiple devices are attached

Before anything else: I am VERY happy with this tool and the high quality output I get from this. Never had similar easy results using the official Mac/Windows software.

When connecting only my LabelManager-PnP, this excellent software works as documented/expected.

But apparentlly when I connect both my LabelManager-PnP and my LabelWriter-450 concurrently, dymoprint has an unhandled error.

For me the fix would be to just always have it point at the LabelManger-PnP because I use glabel for the 450 model right now.

eelco@tux:~$ dymoprint -s b -qr https://github.com/computerlyrik/dymoprint test this 
Found multiple Dymo devices:
<DEVICE ID 0922:1002 on Bus 003 Address 016>
  manufacturer: Dymo
  product: DYMO LabelManager PnP
  serial: 01534802072010
  configurations:
  - <CONFIGURATION 1: 500 mA>
    interfaces:
    - <INTERFACE 0: Printer>
    - <INTERFACE 1: Mass Storage>
    - <INTERFACE 2: Human Interface Device>

Traceback (most recent call last):
  File "/home/eelco/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/dymoprint/detect.py", line 30, in device_info
    dev.manufacturer
  File "/home/eelco/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/usb/core.py", line 898, in manufacturer
    self._manufacturer = util.get_string(self, self.iManufacturer)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/eelco/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/usb/util.py", line 313, in get_string
    raise ValueError("The device has no langid"
ValueError: The device has no langid (permission issue, no string descriptors supported or device error)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/eelco/.local/bin/dymoprint", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/eelco/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/dymoprint/command_line.py", line 265, in main
    print_label(label_bitmap, margin_px=args.m, tape_size_mm=args.t)
  File "/home/eelco/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/dymoprint/dymo_print_engines.py", line 324, in print_label
    detected_device = detect_device()
                      ^^^^^^^^^^^^^^^
  File "/home/eelco/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/dymoprint/detect.py", line 64, in detect_device
    print(device_info(dev))
          ^^^^^^^^^^^^^^^^
  File "/home/eelco/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/dymoprint/detect.py", line 32, in device_info
    instruct_on_access_denied(dev)
  File "/home/eelco/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/dymoprint/detect.py", line 137, in instruct_on_access_denied
    instruct_on_access_denied_linux(dev)
  File "/home/eelco/.local/pipx/venvs/dymoprint/lib/python3.11/site-packages/dymoprint/detect.py", line 214, in instruct_on_access_denied_linux
    raise RuntimeError("\n\n" + "\n".join(lines) + "\n")
RuntimeError: 

You do not have sufficient access to the device. You probably want to add the a udev rule in /etc/udev/rules.d with the following command:

  echo 'ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0922", ATTRS{idProduct}=="0020", MODE="0666"' | sudo tee /etc/udev/rules.d/91-dymo-20.rules

Next refresh udev with:

  sudo udevadm control --reload-rules
  sudo udevadm trigger --attr-match=idVendor="0922"

Finally, turn your device off and back on again to activate the new permissions.

If this still does not resolve the problem, you might need to reboot. In case rebooting is necessary, please report this at <https://github.com/computerlyrik/dymoprint/pull/56>. We are still trying to figure out a simple procedure which works for everyone. In case you still cannot connect, or if you have any information or ideas, please post them at that link.

Problem printing Umlaute

Just tried to print a label containing the german umlaut 'ä'. However this doesnt work.
I'm not sure if this is charset problem or a limitation of imagemagick.

Does not work on windows

I got this issue when I try to use anything from dymoprint:

Traceback (most recent call last):
  File "C:\Users\lock3\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\test\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\test\dymo_print\venv\Scripts\dymoprint.exe\__main__.py", line 5, in <module>
  File "c:\users\test\dymo_print\venv\lib\site-packages\dymoprint\command_line.py", line 34, in <module>
    from .font_config import font_filename
  File "c:\users\test\dymo_print\venv\lib\site-packages\dymoprint\font_config.py", line 9, in <module>
    from .utils import die
  File "c:\users\test\dymo_print\venv\lib\site-packages\dymoprint\utils.py", line 10, in <module>
    import fcntl
ModuleNotFoundError: No module named 'fcntl'

I see at here: https://stackoverflow.com/questions/45228395/error-no-module-named-fcntl
the fcntl does not exist at Windows
And it seems right: https://docs.python.org/3/library/fcntl.html

It is planned to be working at Windows, or not?
Thank you very much your reply in advance!

And thank you your contribution in the python world :)

USB time out on Ubuntu 22.04.3 LTS

Hi,
I installed everything without problem, and set the permissions as suggested.
When running a simple test, I get the following error:

dymoprint "test"
Found one Dymo device: <DEVICE ID 0922:1002 on Bus 001 Address 010>
  manufacturer: Dymo
  product: DYMO LabelManager PnP
  serial: 07264931032016
  configurations:
  - <CONFIGURATION 1: 500 mA>
    interfaces:
    - <INTERFACE 0: Printer>
    - <INTERFACE 1: Mass Storage>
    - <INTERFACE 2: Human Interface Device>

Recognized device as LabelManager PnP (mode switch)
Active device configuration already found.
Opened printer interface: <INTERFACE 0: Printer>
Printing label..
Sending chunk of 573 bytes
Sending chunk of 322 bytes
Traceback (most recent call last):
  File "/home/piet/.local/bin/dymoprint", line 8, in <module>
    sys.exit(main())
  File "/home/piet/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/command_line.py", line 265, in main
    print_label(label_bitmap, margin_px=args.m, tape_size_mm=args.t)
  File "/home/piet/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/dymo_print_engines.py", line 357, in print_label
    lm.printLabel(label_matrix, margin_px=margin_px)
  File "/home/piet/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/labeler.py", line 210, in printLabel
    self.rawPrintLabel(lines, margin_px=margin_px)
  File "/home/piet/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/labeler.py", line 222, in rawPrintLabel
    response = self.sendCommand()
  File "/home/piet/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/labeler.py", line 74, in sendCommand
    rspBin = self.devin.read(8)
  File "/home/piet/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/core.py", line 423, in read
    return self.device.read(self, size_or_buffer, timeout)
  File "/home/piet/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/core.py", line 1029, in read
    ret = fn(
  File "/home/piet/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/backend/libusb1.py", line 846, in bulk_read
    return self.__read(self.lib.libusb_bulk_transfer,
  File "/home/piet/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/backend/libusb1.py", line 954, in __read
    _check(retval)
  File "/home/piet/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/backend/libusb1.py", line 602, in _check
    raise USBTimeoutError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBTimeoutError: [Errno 110] Operation timed out

Any idea what could be the problem?

QR code printing broken

Using the recent master branch (8c1014c) breaks the qr code printing for me. Unfortunately I'm not that familiar with Python, so I was unable to figure out a solution myself. I'm currently running an Arch Linux with Python 3.7.2.

Last working commit: 5e912da

user@machine ~/dymoprint$ ./dymoprint -qr "Test"
./dymoprint:402: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.
conf = SafeConfigParser(FONT_CONFIG)
Traceback (most recent call last):
File "./dymoprint", line 590, in
main(args)
File "./dymoprint", line 500, in main
die("Error: %s" % e_qrcode)
NameError: name 'e_qrcode' is not defined

No module named 'fcntl'

After installing:

pipx install dymoprint

I tried to run it:

dymoprint MyText

but I got:

ModuleNotFoundError: No module named 'fcntl'

Timeout problem using Words with "R" at the beginning of a line

With some String combinations the connection times out. Still unclear what it is causing it, but it is reproducable:

./dymoprint -s b "Rose Regenbogen" "" "03.05.2017"
Printing label..
Traceback (most recent call last):
  File "./dymoprint", line 576, in <module>
    main(args)
  File "./dymoprint", line 570, in main
    lm.printLabel(labelmatrix)
  File "./dymoprint", line 202, in printLabel
    self.rawPrintLabel(lines, margin=margin)
  File "./dymoprint", line 224, in rawPrintLabel
    response = self.sendCommand()
  File "./dymoprint", line 103, in sendCommand
    responseBin = self.dev.read(8)
IOError: [Errno 110] Connection timed out

The device needs at least a power-cycle to run again.

More admin powers?

Hi @computerlyrik, it would be nice to change the branch name from master to main in order to keep up with the times.

Apart from having push access, I don't seem to be able to adjust any of the repository settings. Would it be possible to give me permissions to make such changes?

Application does not detect networked printer

Hi,

I have an issue with the application. If i try to print via USB, this works. But i want to use this using a RPI on a network.
I can print to the printer using printf "lol" | lp -o landscape and this works by printing from a remote laptop to CUPS (Dymo 550) connected on a RPI (USB).

But the application (CLI or GUI) cannot find this printer and error's out with the following error.
`$ dymoprint -qr qrencoded "qr_txt"
No Dymo devices found (expected vendor 0x922)

  • Vendor ID: 0x1d6b Product ID: 0x3
  • Vendor ID: 0x46d Product ID: 0xc52b
  • Vendor ID: 0x8087 Product ID: 0x26
  • Vendor ID: 0x5986 Product ID: 0x211c
  • Vendor ID: 0x1d6b Product ID: 0x2
    Unable to open device.
    Traceback (most recent call last):
    File "/home/user/.local/bin/dymoprint", line 8, in
    sys.exit(main())
    File "/home/user/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/command_line.py", line 265, in main
    print_label(label_bitmap, margin_px=args.m, tape_size_mm=args.t)
    File "/home/user/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/dymo_print_engines.py", line 324, in print_label
    detected_device = detect_device()
    File "/home/user/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/detect.py", line 60, in detect_device
    die("Unable to open device.")
    File "/home/user/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/utils.py", line 19, in die
    raise RuntimeError(message)
    RuntimeError: Unable to open device.
    `

Allow larger tape sizes

I tried this program with the LabelWriter 400 and it works well! Only one issue is that the text is too small when printing on address stickers, as they wider than the max of 19mm, Is it possible to allow custom tape sizes in dymoprint_gui?

No .ini file example in the README

I had a little investigate and this type of thing seems to work

~/.config/dymoprint.ini

[FONTS]
regular=/usr/share/fonts/truetype/freefont/FreeMono.ttf

Letter "C" issue - stucks while printing

Hello,

Your program works perfectly, when I'm not trying to print something that begins with capital c the print stucks and I get this :

-> ./dymoprint -s b "CCCCC"
Printing label..
Traceback (most recent call last):
File "./dymoprint", line 632, in
main(args)
File "./dymoprint", line 626, in main
lm.printLabel(labelmatrix)
File "./dymoprint", line 215, in printLabel
self.rawPrintLabel(lines, margin=margin)
File "./dymoprint", line 237, in rawPrintLabel
response = self.sendCommand()
File "./dymoprint", line 116, in sendCommand
responseBin = self.dev.read(8)
TimeoutError: [Errno 110] Connection timed out

Support for additional devices

This issue has been migrated here. Please continue discussion there.

There is a lot of discussion all over the place about support for other devices. Let's try to bring it all under one place.

  • LabelManager 420P:

    • Apparent but unconfirmed success:

      I had to change the product ID in the code, from 0x1002 to 0x1004. (Also, in the USB rules, I had to change 0x1001 to 0x1003.)

      - @jpetazzo, #30 (comment)

    • usb-modeswitch-data

      # Dymo LabelManager 420P
      TargetVendor= 0x0922
      TargetProduct= 0x1004
      MessageEndpoint=0x01
      ResponseEndpoint=0x01
      MessageContent="1b5a01"
      
  • LabelManager Wireless PnP

    • Status unknown
    • usb-modeswitch-data
      # Dymo LabelManager Wireless PnP
      TargetVendor= 0x0922
      TargetProduct= 0x1008
      MessageEndpoint=0x01
      ResponseEndpoint=0x01
      MessageContent="1b5a01"
      
  • MobileLabeler

  • LabelManager 280

    • Active discussion in #40

    • ID 0922:1005 Dymo-CoStar Corp. DYMO LabelManager 280

      Not a HID, but recognized by CUPS.
      - @Scorcerer #40 (comment)

  • LabelWriter 450

    • This uses a different technology, more like a regular printer, so I don't see how we'd be able to support it anytime soon. This should be doable, and in fact there is a reference manual.
  • LabelPoint 350

    • This supports 19mm tape. Implemented in #73
  • LabelManager PC

  • LabelWriter 400

Fork this project to a new GH org, and deprecate it

As discussed in PR #113, we plan to fork this project in a new Github organization. This issue is for discussing and managing related logistics.

Name

Reasonable names are hard to find, as they are mostly already taken by other companies and products.
I consulted OpenAI, and came up with the name 'LabelGenious'. @maresb, @tomek-szczesny please approve.

Device permissions

Hi,

Can't manage to solve the device permissions so the script won't need root permissions to print.

I've copied the files:
sudo cp 91-dymo-labelmanager-pnp.rules /etc/udev/rules.d/
sudo cp dymo-labelmanager-pnp.conf /etc/usb_modeswitch.d/

And added the lines as the script suggested:
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0922", ATTRS{idProduct}=="1001", MODE="0660", GROUP="users"
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0922", ATTRS{idProduct}=="1002", MODE="0660", GROUP="users"

Unplugged the device, plugged it in again, but the script still need root permissions to print :(

Will appreciate your help with that.

Thanks.

[Errno 110] and [Errno 16] on Ubuntu

I have installed dymoprint on Ubuntu 22.04 following the instructions on this projects page, and am using a DYMO LabelManager Plug N Play, but since right after installing, I get two errors. This first error message usb.core.USBTimeoutError: [Errno 110] Operation timed out appears when I try to print and the second error message usb.core.USBError: [Errno 16] Resource busyappears in subsequent tries.
I got the printer to work twice, but I am not sure what actually made it work, likely only a coincidence. The first time I had tried a few times and it failed, so I had left my computer running for a few days, and when I tried again, I was able to print, and turned my computer off. The second time, after many failed attempts, I turned off the power of the printer using the Ubuntu Disk app, the unplugged the printer and plugged the printer back in and I was able to print a couple of labels. I have tried that same trick later but it has not worked for me.
Ubuntu had detected and installed this device as a printer, so I removed it from the printer list, but it still doesn't work with dymoprint.

Here are the full error logs:

[Errno 110]:
`Traceback (most recent call last):
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/gui.py", line 163, in print_label
    self.print_server.print_label(self.label_bitmap, self.margin.value())
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/dymo_print_engines.py", line 491, in print_label
    lm.printLabel(label_matrix, margin=margin)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/labeler.py", line 203, in printLabel
    self.rawPrintLabel(lines, margin=margin)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/labeler.py", line 225, in rawPrintLabel
    response = self.sendCommand()
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/labeler.py", line 72, in sendCommand
    rspBin = self.devin.read(8)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/core.py", line 423, in read
    return self.device.read(self, size_or_buffer, timeout)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/core.py", line 1029, in read
    ret = fn(
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/backend/libusb1.py", line 846, in bulk_read
    return self.__read(self.lib.libusb_bulk_transfer,
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/backend/libusb1.py", line 954, in __read
    _check(retval)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/backend/libusb1.py", line 602, in _check
    raise USBTimeoutError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBTimeoutError: [Errno 110] Operation timed out`

[Errno 16]:
`Traceback (most recent call last):
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/gui.py", line 163, in print_label
    self.print_server.print_label(self.label_bitmap, self.margin.value())
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/dymo_print_engines.py", line 491, in print_label
    lm.printLabel(label_matrix, margin=margin)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/labeler.py", line 203, in printLabel
    self.rawPrintLabel(lines, margin=margin)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/labeler.py", line 225, in rawPrintLabel
    response = self.sendCommand()
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/dymoprint/labeler.py", line 71, in sendCommand
    cmdBin.tofile(self.devout)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/core.py", line 408, in write
    return self.device.write(self, data, timeout)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/core.py", line 986, in write
    intf, ep = self._ctx.setup_request(self, endpoint)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/core.py", line 229, in setup_request
    self.managed_claim_interface(device, intf)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/core.py", line 178, in managed_claim_interface
    self.backend.claim_interface(self.handle, i)
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/backend/libusb1.py", line 829, in claim_interface
    _check(self.lib.libusb_claim_interface(dev_handle.handle, intf))
  File "/home/mypc/.local/pipx/venvs/dymoprint/lib/python3.10/site-packages/usb/backend/libusb1.py", line 604, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 16] Resource busy`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.