SVG import error #85687

Closed
opened 2021-02-16 11:28:15 +01:00 by Álvaro Mondéjar · 10 comments

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: blender/blender@3e55d7d605
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

Open new file with default layout.

Go to File -> Import -> Scalable Vector Graphics (.svg) and select the provided file.

**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: `blender/blender@3e55d7d605` Worked: **Short description of error** Importing [this SVG file ](https://raw.githubusercontent.com/simple-icons/simple-icons/23f0c1a466891f1a7f4790391f44b6fabe37f528/icons/apache.svg) 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** # Open new file with default layout. # Go to File -> Import -> Scalable Vector Graphics (.svg) and select the provided file.

Added subscriber: @mondeja

Added subscriber: @mondeja

#73179 was marked as duplicate of this issue

#73179 was marked as duplicate of this issue
Member

Added subscriber: @filedescriptor

Added subscriber: @filedescriptor
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

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

I can confirm this issue on the latest 2.93.0 Alpha, branch: master, commit date: 2021-02-14 21:31, hash: `blender/blender@7a608f88a7`.
Member

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'].

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 ](https://developer.blender.org/D10433).

I've added a patch for this in [[D10433](https://archive.blender.org/developer/D10433) ](https://developer.blender.org/D10433).
Member

Added subscribers: @JakubSteiner, @jenkm

Added subscribers: @JakubSteiner, @jenkm

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Álvaro Mondéjar self-assigned this 2021-10-26 12:53:42 +02:00

It seems fixed in 2.93.5, so I suppose that this task can be closed.

It seems fixed in 2.93.5, so I suppose that this task can be closed.
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#85687
No description provided.