Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run test case #10

Closed
igitur opened this issue Jul 20, 2023 · 1 comment
Closed

Cannot run test case #10

igitur opened this issue Jul 20, 2023 · 1 comment

Comments

@igitur
Copy link

igitur commented Jul 20, 2023

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
Copy link
Owner

ducky64 commented Aug 13, 2023

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.

@ducky64 ducky64 closed this as completed Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants