l0b0 / paths2openscad

No longer maintained SVG paths to OpenSCAD converter
GNU General Public License v2.0
71 stars 46 forks source link

TypeError: float() argument #17

Open deckar01 opened 6 years ago

deckar01 commented 6 years ago

MacOS: v10.12.6 Inkscape: v0.92 paths2openscad: v6 (and master)

Traceback (most recent call last):
  File "paths2openscad.py", line 916, in <module>
    e.affect()
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 283, in affect
    self.effect()
  File "paths2openscad.py", line 876, in effect
    self.recursivelyTraverseSvg( self.document.getroot(), self.docTransform )
  File "paths2openscad.py", line 632, in recursivelyTraverseSvg
    x = float( node.get( 'x' ) )
TypeError: float() argument must be a string or a number
deckar01 commented 6 years ago

I didn't have the shape selected before I ran the extension. I downloaded Inkscape just for this extension, so I expected it to use all the paths in the SVG I opened. I wasted a bit of time troubleshooting before realizing this. It might help to detect when nothing is selected and give a more descriptive error message.

FWIW I added a try/except to the line 632 (and 633) and got an error about the "SVG" not being valid. Both error messages seemed to indicate it was an issue with my SVG's encoding. Selecting the object with Inkscape first worked though.