Error during Save As DXF when SVG has comments
Summary:
Attempting to take an SVG and Save As a DXF yields a traceback crash, and the save fails. The issue seems to be that it cannot process <!-- -->
XML comments. Removing the comments resolves the issue, and the file saves normally.
Steps to reproduce:
- Open any old SVG file in a text editor. I use Kate because I'm on KDE.
- Insert an XML comment, such as
<!-- test comment -->
it appears that content and length don't matter. Save and close. - Open the modified SVG in Inkscape.
- Try to Save the SVG As a DXF.
- Behold the glory of the failed save.
What happened?
Got the following dump:
Traceback (most recent call last):
File "/usr/share/inkscape/extensions/dxf_outlines.py", line 443, in <module>
DxfOutlines().run()
File "/usr/share/inkscape/extensions/inkex/base.py", line 231, in run
self.save_raw(self.effect())
^^^^^^^^^^^^^
File "/usr/share/inkscape/extensions/dxf_outlines.py", line 424, in effect
self.process_group(self.svg)
File "/usr/share/inkscape/extensions/dxf_outlines.py", line 353, in process_group
self.process_shape(node, self.groupmat[-1])
File "/usr/share/inkscape/extensions/dxf_outlines.py", line 269, in process_shape
style = node.style("stroke")
^^^^^^^^^^
AttributeError: 'lxml.etree._Comment' object has no attribute 'style'
And the save fails
What should have happened?
The file should save normally as it does when it has no comments. Since comments should be ignored, anyway, the save should simply disregard comments.
Version info
Inkscape 1.2.2 (b0a8486541, 2022-12-01)
GLib version: 2.78.0
GTK version: 3.24.38
glibmm version: 2.66.5
gtkmm version: 3.24.7
libxml2 version: 2.9.14
libxslt version: 1.1.35
Cairo version: 1.18.0
Pango version: 1.51.0
HarfBuzz version: 8.0.1
OS version: Debian GNU/Linux trixie/sid