ducky64 / labelmaker

Labelmaker using SVG templates and CSV data
GNU General Public License v2.0
8 stars 5 forks source link

Cannot run test case #10

Closed igitur closed 1 year ago

igitur commented 1 year ago

Hi,

I'm running python labelmaker.py tests/testtemplate.svg configs/1.75in_x_0.5in_4x6.ini tests/testdata.csv gen.svg but getting this error:

Traceback (most recent call last):
  File "D:\dev\labelmaker\labelmaker.py", line 141, in <module>
    for elt in template.generate(row):
  File "D:\dev\labelmaker\SvgTemplate.py", line 449, in generate
    substitute(filter_obj, elt)
  File "D:\dev\labelmaker\SvgTemplate.py", line 444, in substitute
    substitute(filter_obj, child)
  File "D:\dev\labelmaker\SvgTemplate.py", line 442, in substitute
    filter_obj.apply(self, elt, data_dict)
  File "D:\dev\labelmaker\SvgTemplate.py", line 131, in apply
    new_elts = self.replace(template, get_text_contents(text_elt), rect_elt)
  File "D:\dev\labelmaker\SvgTemplate.py", line 265, in replace
    thickness = units_to_pixels(cmd.get_kw_arg('thickness', 'barcode thickness', 3)) * template.get_viewbox_correction()
  File "D:\dev\labelmaker\SvgTemplate.py", line 52, in units_to_pixels
    match = re.search(r"(\d*.?\d+)\s*(\w*)", units_num)
  File "D:\scoop\apps\python\current\lib\re.py", line 201, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object
$ python --version
Python 3.9.6
ducky64 commented 1 year ago

Thanks, and fixed! (the issue is that the default value in the code was an int while a string was expected)

Also, this project has been superseded by https://github.com/ducky64/pysvglabel, which supports Python code in templates for more advanced operations - though if you just need basic text substitution and barcoding, this project will still work fine. I've also updated the readme to reflect this.