zpl icon indicating copy to clipboard operation
zpl copied to clipboard

formatted strings in barcode() do not format correctly

Open john-theller opened this issue 3 years ago • 2 comments

the \ line break in barcode_zpl assignment prevents the entire string from being formatted.

john-theller avatar Aug 23 '22 17:08 john-theller

Can you elaborate?

cod3monk avatar Aug 29 '22 16:08 cod3monk

ex. at line 265 of label.py:

        elif barcode_type == '3':
            barcode_zpl = '^B{barcode_type}{orientation},{check_digit},{height:d},{print_interpretation_line},'+\
                            '{print_interpretation_line_above}'.format(**locals())

This results in '{print_interpretation_line_above}' formatting correctly, while '{barcode_type}{orientation},{check_digit},{height:d},{print_interpretation_line}' do not get formatted with the local variables

john-theller avatar Aug 29 '22 18:08 john-theller

I have this issue as well and I brought a reproducible example:

import zpl

l = zpl.Label(42, 24)
l.origin(1, 10)
l.barcode('C', '111111111111')
l.endorigin()
l.dumpZPL()

Out[22]: '^XA^FO12,120^B{barcode_type}{orientation},{height:d},{print_interpretation_line},N,N,N^FD111111111111^FS^XZ'

I guess I'll go back to 0.1.8 for now - looks like this bug was introduced about 4 month ago.

ipeterov avatar Sep 06 '22 13:09 ipeterov

Hey @cod3monk! Do you mind if I make a pull request to fix this particular bug, but also add a PR with some tests and GitHub-based CI?

ipeterov avatar Sep 06 '22 13:09 ipeterov

Huh, cool, GameGrime fixed the bug already 👍

Still, would you be open to some tests + CI setup?

ipeterov avatar Sep 06 '22 13:09 ipeterov

Thanks! I gladly take PRs and would love a CI setup, but am currently too busy to build it myself. If you are up for it, please go ahead :)

cod3monk avatar Sep 12 '22 08:09 cod3monk