Strange path attribute leads to the fail of plt export through Uniconverter

Bug #890139 reported by Nizamov Shawkat
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Medium
Unassigned

Bug Description

1) Create a line (with Shift+F6)
2) Stroke to path (Ctrl+Alt+C)
3) Save as svg (file is attached).
4) try to save as plt - fails (see the traceback below).

The reason of fail is the strange path attribute that appears after step 2, in svg file it corresponds to the following path attribute :

 <path
       style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"

It is not clear for me whether this is a wrong attribute (I did not find anything similar in SVG specification) or the wrong data in it (size specified as string "medium", not as a float number as expected by Uniconverter) or the bug in Uniconverter.
I am using Inkscape 0.48.2 as provided in Ubuntu 11.10

UniConvertor failed:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/plugins/Filters/svgloader.py", line 980, in Load
    xml_reader.parse(input_source)
  File "/usr/lib/python2.7/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python2.7/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/usr/lib/python2.7/xml/sax/expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "/usr/lib/python2.7/xml/sax/expatreader.py", line 301, in start_element
    self._cont_handler.startElement(name, AttributesImpl(attrs))
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/plugins/Filters/svgloader.py", line 338, in startElement
    getattr(self, method)(attrs)
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/plugins/Filters/svgloader.py", line 837, in begin_path
    self.parse_style(style)
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/plugins/Filters/svgloader.py", line 384, in parse_style
    self.try_add_style(key, val)
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/plugins/Filters/svgloader.py", line 429, in try_add_style
    self.style.font_size = self.user_length(val)
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/plugins/Filters/svgloader.py", line 472, in user_length
    return float(str) * factor
ValueError: could not convert string to float: medium

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/uniconvertor/__init__.py", line 82, in uniconv
    doc = load.load_drawing(input_file)
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/io/load.py", line 364, in load_drawing
    return load_drawing_from_file(file, filename)
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/io/load.py", line 337, in load_drawing_from_file
    doc = loader.Load()
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/plugins/Filters/svgloader.py", line 980, in Load
    xml_reader.parse(input_source)
  File "/usr/lib/python2.7/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python2.7/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/usr/lib/python2.7/xml/sax/expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "/usr/lib/python2.7/xml/sax/expatreader.py", line 301, in start_element
    self._cont_handler.startElement(name, AttributesImpl(attrs))
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/plugins/Filters/svgloader.py", line 338, in startElement
    getattr(self, method)(attrs)
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/plugins/Filters/svgloader.py", line 837, in begin_path
    self.parse_style(style)
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/plugins/Filters/svgloader.py", line 384, in parse_style
    self.try_add_style(key, val)
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/plugins/Filters/svgloader.py", line 429, in try_add_style
    self.style.font_size = self.user_length(val)
  File "/usr/lib/pymodules/python2.7/uniconvertor/app/plugins/Filters/svgloader.py", line 472, in user_length
    return float(str) * factor
ValueError: could not convert string to float: medium

Revision history for this message
Nizamov Shawkat (nizamov-shawkat) wrote :
Revision history for this message
Alvin Penner (apenner) wrote :

confirmed on Windows XP, Inkscape build 10728.
an alternative may be to use the .hpgl output filetype, which produces the attached result:

Changed in inkscape:
status: New → Confirmed
su_v (suv-lp)
tags: added: exporting uniconvertor
Revision history for this message
su_v (suv-lp) wrote :

> It is not clear for me whether this is a wrong attribute
> (I did not find anything similar in SVG specification)

When converting a stroke to path, Inkscape adds a lot of seemingly unrelated default style properties to the 'style' attribute of the resulting path. I did not really get an explanation when recently asking about this in 'inkscape-devel':
<http://thread.gmane.org/gmane.comp.graphics.inkscape.devel/37131/focus=37160>
but I assume based on the partial answer given:
<http://thread.gmane.org/gmane.comp.graphics.inkscape.devel/37131/focus=37195>
that this is done in general to override any potential parent style attributes which might change the appearance of the converted stroke unexpectedly to the user.

UniConvertor should not crash however when encountering such a 'style' attribute on regular paths IMHO.

Changed in inkscape:
importance: Undecided → Medium
Revision history for this message
su_v (suv-lp) wrote :

Upstream bug report:
Issue 21 - sk1 - Errors converting to WMF (UniConvertor failed)
<http://code.google.com/p/sk1/issues/detail?id=21>

Revision history for this message
Martin (mart1n) wrote :

Inkscape is still doing this ie when you create a stroke and convert to a path uniconverter fails.

Tested on
Win 7 and OSX 10.10.2 with latest stable download of inkscape

Revision history for this message
Roul P. (perhelion1) wrote :

In addition the "enable-background" is not allowed on path elements, could be a second bug.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.