Page MenuHome

SVG import error
Confirmed, NormalPublic

Description

System Information
Operating system: Linux-5.4.0-65-generic-x86_64-with-debian-bullseye-sid 64 Bits
Graphics card: AMD RAVEN (DRM 3.35.0, 5.4.0-65-generic, LLVM 11.0.0) X.Org 4.6 (Core Profile) Mesa 20.2.6

Blender Version
Broken: version: 2.92.0 Beta, branch: master, commit date: 2021-02-15 19:10, hash: rB3e55d7d60542
Worked:

Short description of error
Importing this SVG file raises next error:

Python: Traceback (most recent call last):
  File "/.../blender-2.92.0-3e55d7d60542-linux64/2.92/scripts/addons/io_curve_svg/__init__.py", line 59, in execute
    return import_svg.load(self, context, filepath=self.filepath)
  File "/.../blender-2.92.0-3e55d7d60542-linux64/2.92/scripts/addons/io_curve_svg/import_svg.py", line 1882, in load
    load_svg(context, filepath, do_colormanage)
  File "/.../blender-2.92.0-3e55d7d60542-linux64/2.92/scripts/addons/io_curve_svg/import_svg.py", line 1872, in load_svg
    loader.parse()
  File "/.../blender-2.92.0-3e55d7d60542-linux64/2.92/scripts/addons/io_curve_svg/import_svg.py", line 1085, in parse
    ob = parseAbstractNode(node, self._context)
  File "/.../blender-2.92.0-3e55d7d60542-linux64/2.92/scripts/addons/io_curve_svg/import_svg.py", line 1856, in parseAbstractNode
    ob.parse()
  File "/.../blender-2.92.0-3e55d7d60542-linux64/2.92/scripts/addons/io_curve_svg/import_svg.py", line 1085, in parse
    ob = parseAbstractNode(node, self._context)
  File "/.../blender-2.92.0-3e55d7d60542-linux64/2.92/scripts/addons/io_curve_svg/import_svg.py", line 1856, in parseAbstractNode
    ob.parse()
  File "/.../blender-2.92.0-3e55d7d60542-linux64/2.92/scripts/addons/io_curve_svg/import_svg.py", line 1135, in parse
    pathParser.parse()
  File "/.../blender-2.92.0-3e55d7d60542-linux64/2.92/scripts/addons/io_curve_svg/import_svg.py", line 898, in parse
    cmd(code)
  File "/.../blender-2.92.0-3e55d7d60542-linux64/2.92/scripts/addons/io_curve_svg/import_svg.py", line 860, in _pathCurveToA
    x, y = self._getCoordPair(code.islower(), self._point)
  File "/.../blender-2.92.0-3e55d7d60542-linux64/2.92/scripts/addons/io_curve_svg/import_svg.py", line 543, in _getCoordPair
    y = self._data.nextCoord()
  File "/.../blender-2.92.0-3e55d7d60542-linux64/2.92/scripts/addons/io_curve_svg/import_svg.py", line 484, in nextCoord
    return float(token)
ValueError: could not convert string to float: 'c'

Exact steps for others to reproduce the error

  1. Open new file with default layout.
  2. Go to File -> Import -> Scalable Vector Graphics (.svg) and select the provided file.

Event Timeline

Falk David (filedescriptor) changed the task status from Needs Triage to Confirmed.Tue, Feb 16, 11:33 AM

I can confirm this issue on the latest 2.93.0 Alpha, branch: master, commit date: 2021-02-14 21:31, hash: rB7a608f88a713.

Found the issue. The .svg contains path commands like : a44.457 44.457 0 00-1.265 2.29. The a command needs a multiple of 7 parameters. Our number parser parses this as ['a', '44.457', '44.457', '0', '00', '-1.265', '2.29']. Notice the '00'. This becomes worse when the second to last number is not negative: a2.571 2.571 0 00.637-.698 -> ['a', '2.571', '2.571', '0', '00.637', '-.698'].

I've added a patch for this in D10433.