KeyError: u'linearGradient3326' with option --keep-unreferenced-defs
Created by: JoKalliauer
The comand:
scour -i Oxygen15.04.1-edit-undo.svg -o output.svg --keep-unreferenced-defs
with the following inputfile: https://commons.wikimedia.org/wiki/File:Oxygen15.04.1-edit-undo.svg
lead to following error message:
Traceback (most recent call last):
File "C:\Python27\Scripts\scour-script.py", line 11, in <module>
load_entry_point('scour==0.36', 'console_scripts', 'scour')()
File "c:\python27\lib\site-packages\scour\scour.py", line 3920, in run
start(options, input, output)
File "c:\python27\lib\site-packages\scour\scour.py", line 3888, in start
out_string = scourString(in_string, options).encode("UTF-8")
File "c:\python27\lib\site-packages\scour\scour.py", line 3496, in scourString
while removeDuplicateGradients(doc) > 0:
File "c:\python27\lib\site-packages\scour\scour.py", line 1424, in removeDuplicateGradients
for elem in referencedIDs[dup_id][1]:
KeyError: u'linearGradient3326'
I added the option --keep-unreferenced-defs
to avoid bug #155
Here is a minimal working example: min.svg.txt
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg id="svg2606" width="128" height="128" version="1.0" xmlns="http://www.w3.org/2000/svg">
<defs
id="defs2608">
<linearGradient
id="linearGradient3342">
<stop
id="stop3344"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
id="stop3347"
offset="1"
style="stop-color:#000000;stop-opacity:0;" />
</linearGradient>
<linearGradient
id="linearGradient3326">
<stop
id="stop3328"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
id="stop3330"
offset="1"
style="stop-color:#000000;stop-opacity:0;" />
</linearGradient>
</defs>
</svg>