Division by Zero

Bug #1739970 reported by Miles B Huff
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Undecided
Unassigned

Bug Description

When attempting to save the attached file as an Optimized SVG, I get the following error (on both Inkscape 0.92 and 0.91):

Traceback (most recent call last):
  File "scour.inkscape.py", line 73, in <module>
    e.affect(output=False)
  File "/usr/share/inkscape/extensions/inkex.py", line 280, in affect
    self.getposinlayer()
  File "/usr/share/inkscape/extensions/inkex.py", line 222, in getposinlayer
    x = self.unittouu(xattr[0] + 'px')
  File "/usr/share/inkscape/extensions/inkex.py", line 395, in unittouu
    return retval * (self.__uuconv[u.string[u.start():u.end()]] / self.__uuconv[self.getDocumentUnit()])
  File "/usr/share/inkscape/extensions/inkex.py", line 371, in getDocumentUnit
    svgunitfactor = self.__uuconv[svgwidthunit] * width / viewboxwidth
ZeroDivisionError: float division by zero

(This occurred on Linux Mint Sylvia (Ubuntu Xenial).)

Tags: scour
Revision history for this message
Miles B Huff (milesbhuff) wrote :
Revision history for this message
Alvin Penner (apenner) wrote :

reproduced on Windows 10, Inkscape 0.92.2 (5c3e80d, 2017-08-06)

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Alvin Penner (apenner) wrote :

probably related to the fact that the viewbox has zero width in the document.
The viewbox is given as:
   viewBox="-3240000 0 0 1100"
 I would suggest manually editing the viewbox attribute to give it a size consistent with the page dimensions

Revision history for this message
Miles B Huff (milesbhuff) wrote :

Alvin,

Thank you; that worked.

Even so -- Inkscape needs to be able to account for SVG files with incorrectly-set viewboxes, and to prevent such situations from arising in the first place (I created this file in Inkscape and have only ever edited it therein.).

description: updated
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.