Optimized SVG save fails with Attribute error - no 'infilename'

Bug #708515 reported by Lee
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
jazzynico
Scour
Fix Released
Medium
Unassigned
scour (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Attempting to create SVG for an ebook, going through the following steps:

1. Create a new document
2. Import a graphic image from my file system, choose the 'link' option vs. 'embed'
3. Select the image, go to document properties and re-size the canvas based on the selection.
4. Select 'Save As', choose optimized SVG, enable the 'viewbox' option

Save fails with this error:

Traceback (most recent call last):
  File "scour.inkscape.py", line 54, in <module>
    e.affect(output=False)
  File "/Applications/Inkscape.app/Contents/Resources/extensions/inkex.py", line 227, in affect
    self.effect()
  File "scour.inkscape.py", line 47, in effect
    sys.stdout.write(scourString(input.read(), self.options).encode("UTF-8"))
  File "/Applications/Inkscape.app/Contents/Resources/extensions/scour.py", line 2306, in scourString
    embedRasters(elem, options)
  File "/Applications/Inkscape.app/Contents/Resources/extensions/scour.py", line 1950, in embedRasters
    if options.infilename: infilename = options.infilename
AttributeError: Values instance has no attribute 'infilename'

Related branches

Revision history for this message
Lee (ldolse) wrote :

This is on OSX, tried with 0.48 as well as the latest OS X Leopard build from Jan 25, both failed with the same error.

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

Reproduced with Inkscape 0.48+devel r10014 on OS X 10.5.8

It fails to embed raster images, not due to enabling the view-box option. After disabling 'Embed rasters', saving as 'Optimized SVG' works without failure.

(also mentioned in the comments #2, #3 of bug #587746).

tags: added: saving svg
Changed in inkscape:
importance: Undecided → Medium
status: New → Confirmed
tags: added: exporting extensions-plugins
removed: saving svg
Revision history for this message
su_v (suv-lp) wrote :

test file attached, scour fails to embed an image linked like this:

    <image
       y="20"
       x="21"
       id="image140"
       xlink:href="file:///Volumes/blue/img/Inkscape/test/bug/logo.png"
       height="339"
       width="369" />

Revision history for this message
Louis Simard (louis-simard-deactivatedaccount) wrote :

This bug has been fixed in Scour trunk as revision 200. It was caused by a complete lack of check for file:// URLs and some rather bad logic in embedRasters.

Changed in scour:
importance: Undecided → Medium
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package scour - 0.25+bzr207-1

---------------
scour (0.25+bzr207-1) unstable; urgency=low

  * New upstream bzr snapshot:
    - Add the option --no-renderer-workaround.
    - Fix gradient corruption. (LP: #702423)
    - Add option to only remove autogenerated id's. (LP: #492277)
    - Fix Windows line ending handling. (LP: #717826)
    - Fix occasional production of empty defs. (LP: #717254)
    - Remove more attributes with default values. (LP: #714731)
    - Fix wrong handling of file:// references. (LP: #708515)
    - Delete text attributes from groups with only non-text elements.
      (LP: #714727)
    - Remove unnecessary text-align properties from non-text elements.
      (LP: #714720)
    - Fix wrong optimization of 0-length Bézier curves. (LP: #714717)
    - Fix decimal number processing in rule_elliptical_arc(). (LP: #638764)
    - Fix transform matrix order. (LP: #722544)
  * Drop 01-bzr195.patch, upstream now.
  * debian/cmpsvg: Fix computation of difference to add up the absolute
    difference of each pixel.
  * debian/cmpsvg: Show percentages with three digits after comma.
  * debian/cmpsvg: Lower default treshold to 0.05%.
 -- Martin Pitt <email address hidden> Tue, 15 Mar 2011 09:28:45 +0100

Changed in scour (Ubuntu):
status: New → Fix Released
Revision history for this message
Louis Simard (louis-simard-deactivatedaccount) wrote :

This bug is fixed in release 0.26 of Scour.

Changed in scour:
status: Fix Committed → Fix Released
Revision history for this message
jazzynico (jazzynico) wrote :

Fixed in the trunk, revision 10180.

Changed in inkscape:
milestone: none → 0.49
status: Confirmed → Fix Committed
Revision history for this message
su_v (suv-lp) wrote :

> Fixed in the trunk, revision 10180.

Still get the same error with trunk (r11877, OS X 10.7.4; r11870, Ubuntu 12.10) - is this really fixed in trunk?

Error from Ubuntu 12.10:

Traceback (most recent call last):
  File "scour.inkscape.py", line 77, in <module>
    e.affect(output=False)
  File "/home/su-v/local/share/inkscape/extensions/inkex.py", line 262, in affect
    self.effect()
  File "scour.inkscape.py", line 70, in effect
    sys.stdout.write(scourString(input.read(), self.options).encode("UTF-8"))
  File "/home/su-v/local/share/inkscape/extensions/scour.py", line 3018, in scourString
    embedRasters(elem, options)
  File "/home/su-v/local/share/inkscape/extensions/scour.py", line 2622, in embedRasters
    if options.infilename: infilename = options.infilename
AttributeError: Values instance has no attribute 'infilename'

Revision history for this message
jazzynico (jazzynico) wrote :

I confirm it's not fixed. Our scour version, in the trunk, is the very last one (r220), and I can also reproduce the bug on Ubuntu 11.10.

Changed in inkscape:
status: Fix Committed → Triaged
Revision history for this message
jazzynico (jazzynico) wrote :

I also confirm it works correctly when running scour from the command line (no error and image embedded as expected).

Revision history for this message
jazzynico (jazzynico) wrote :

The error is due to the fact that scour needs options.infilename to embed images, and the Inkscape extension doesn't define that option because it doesn't call scour.py with the script options but directly uses the scourString funtion.
I'm going to see if something can be done in scour.inkscape.py.

jazzynico (jazzynico)
Changed in inkscape:
assignee: nobody → JazzyNico (jazzynico)
status: Triaged → In Progress
Revision history for this message
jazzynico (jazzynico) wrote :

Fix committed in the trunk, revision 11878.

Patch attached. @Louis, could you please apply it upstream?
It's a very minor modification (self.options.infilename defined manually) that affects the Inkscape extension only.

Changed in inkscape:
status: In Progress → Fix Committed
Revision history for this message
jazzynico (jazzynico) wrote :
Revision history for this message
Louis Simard (louis-simard-deactivatedaccount) wrote :

Committed your patch to the Scour trunk, revision 221.

Changed in scour:
status: Fix Released → Fix Committed
jazzynico (jazzynico)
Changed in scour:
status: Fix Committed → Fix Released
Changed in inkscape:
status: Fix Committed → Fix Released
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.