Perspective fails with non-Inkscape SVG

Bug #1667959 reported by Tim Tröndle
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Undecided
Unassigned

Bug Description

When opening an SVG file that hasn't been created by Inkscape, there may no "width" and "height" attributes exist in the svg tag. The "Modify Path -> Perspective" script expects these attributes to exist and fails with the error message below if they don't. Adding these attributes manually solves the issue.

```
Traceback (most recent call last):
  File "perspective.py", line 153, in <module>
    e.affect()
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 265, in affect
    self.getposinlayer()
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 207, in getposinlayer
    x = self.unittouu( xattr[0] + 'px' )
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 351, in unittouu
    return retval * (self.__uuconv[u.string[u.start():u.end()]] / self.__uuconv[self.getDocumentUnit()])
  File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 304, in getDocumentUnit
    p = param.match(svgwidth)
TypeError: expected string or buffer
```

Revision history for this message
Alvin Penner (apenner) wrote :

thank you for taking the time to issue a report.
could you indicate which OS, and which version of Inkscape? (see Help->About)

using Windows 10, Inkscape 0.92.1 r15371, I am not able to reproduce the problem, using the attached file.

Revision history for this message
su_v (suv-lp) wrote :

AFAICT a duplicate of
* Bug #1463623 “Error trying to save Optimized SVG (no 'width' attribute for SVGRoot)”
  https://bugs.launchpad.net/inkscape/+bug/1463623

Failure with missing 'height' attribute is tracked in
* Bug #1461346 “getposinlayer fails if height attribute is missing”
  https://bugs.launchpad.net/inkscape/+bug/1461346

(The OS of the reporter is OS X, based on the paths in the backtrace - there have been no new Inkscape packages for OS X available yet which would include the fix for the two mentioned issues (Inkscape >= 0.92)).

tags: added: extensions-plugins
Revision history for this message
Tim Tröndle (timtroendle) wrote :

I'm using Inkscape 0.91 r13725 as downloaded from the website 2 days ago and I am on macOS 10.12.3.

Using your attached file I am seeing not the width error as stated above, but the height error as stated in bug #1461346.

Revision history for this message
su_v (suv-lp) wrote :

Tim Tröndle wrote:
> Using your attached file I am seeing not the width error as stated
> above, but the height error as stated in bug #1461346.

That's because the file from comment #1 also lacks the 'viewBox' attribute - if at least the 'viewBox' attribute is present, the first error encountered will be about the missing 'width' attribute.

Since launchpad does not allow to link a report as duplicate to multiple other reports, linking this one based on the backtrace in the original bug description as duplicate to bug #1463623.

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.