svg2sif icon indicating copy to clipboard operation
svg2sif copied to clipboard

'float' object has no attribute '__getitem__'

Open alex-r-bigelow opened this issue 6 years ago • 4 comments

I'm getting this error trying to export anything from Inkscape as an .sif file:

Traceback (most recent call last):
  File "synfig_output.py", line 1344, in <module>
    e.affect(output=False)
  File "/usr/share/inkscape/extensions/inkex.py", line 283, in affect
    self.effect()
  File "synfig_output.py", line 1053, in effect
    SynfigPrep.effect(self)
  File "/usr/share/inkscape/extensions/synfig_prepare.py", line 483, in effect
    propagate_attribs(self.document.getroot())
  File "/usr/share/inkscape/extensions/synfig_prepare.py", line 383, in propagate_attribs
    dw = get_dimension(node.get("width", vw))
  File "/usr/share/inkscape/extensions/synfig_prepare.py", line 455, in get_dimension
    elif s[-1] == "%":
TypeError: 'float' object has no attribute '__getitem__'

Example of a file that causes this error: https://github.com/mure-apps/origraph/blob/views/src/img/supernode.svg

alex-r-bigelow avatar Jun 04 '18 18:06 alex-r-bigelow

Same here

helgek avatar Aug 11 '18 11:08 helgek

Same here. I'm on Antergos+XFCE. Full log:

Traceback (most recent call last):
  File "synfig_output.py", line 1344, in <module>
    e.affect(output=False)
  File "/usr/share/inkscape/extensions/inkex.py", line 283, in affect
    self.effect()
  File "synfig_output.py", line 1053, in effect
    SynfigPrep.effect(self)
  File "/usr/share/inkscape/extensions/synfig_prepare.py", line 483, in effect
    propagate_attribs(self.document.getroot())
  File "/usr/share/inkscape/extensions/synfig_prepare.py", line 383, in propagate_attribs
    dw = get_dimension(node.get("width", vw))
  File "/usr/share/inkscape/extensions/synfig_prepare.py", line 455, in get_dimension
    elif s[-1] == "%":
TypeError: 'float' object has no attribute '__getitem__'

Zeioth avatar Jun 05 '19 10:06 Zeioth

According to my experience, if the input SVG file is generated in responsive size mode, script fails to create a SIF file. Just regenerate the input SVG file in fixed-size mode and try again.

mghmgh1281375 avatar Aug 24 '19 16:08 mghmgh1281375

Thanks mghmgh1281375. That's worked fine!

Maddogbill-bral avatar Aug 21 '20 23:08 Maddogbill-bral