Klowner/inkscape-applytransforms

`TypeError: uutounit() missing 1 required positional argument: 'to_unit'`

Closed this issue · 1 comments

On inkscape 1.0.2 (e86c8708, 2021-01-15), I run this extension on a file and get

Traceback (most recent call last):
  File "applytransform.py", line 159, in <module>
    ApplyTransform().run()
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/base.py", line 140, in run
    self.save_raw(self.effect())
  File "applytransform.py", line 25, in effect
    self.recursiveFuseTransform(self.document.getroot())
  File "applytransform.py", line 156, in recursiveFuseTransform
    self.recursiveFuseTransform(child, transf)
  File "applytransform.py", line 156, in recursiveFuseTransform
    self.recursiveFuseTransform(child, transf)
  File "applytransform.py", line 156, in recursiveFuseTransform
    self.recursiveFuseTransform(child, transf)
  File "applytransform.py", line 77, in recursiveFuseTransform
    self.scaleStrokeWidth(node, transf)
  File "applytransform.py", line 48, in scaleStrokeWidth
    stroke_width = self.svg.uutounit(style.get('stroke-width').strip())
TypeError: uutounit() missing 1 required positional argument: 'to_unit'

related: #43

From https://gitlab.com/inkscape/extensions/-/blob/3796f912f666a0981917839c77eb94fdd6fc6a94/inkex/elements/_base.py#L453 it doesn't seem that to_unit is a required argument. But for me, that function is defined in /Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex/elements/_svg.py as

    def uutounit(self, value, to_unit):
        """Convert from the document's units to the given unit"""
        return convert_unit(render_unit(value, self.unit), to_unit)

So this must have changed in a more recent Inkscape release. Indeed, at this commit:

https://gitlab.com/inkscape/extensions/-/commit/e15529f3ae9c1ee951ca4a60fd7b9f24be16126c

It should just be passed the "px" argument, then.

The most recent update replaced that uutounit() call with a unittouu(), so I'm assuming this is probably fixed and I'll close the issue. If you're still experiencing this problem with the current version of the extension please reopen the issue. 👍