This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: xml.dom.minidom fail to parse SVG file.
Type: Stage: needs patch
Components: Extension Modules Versions: Python 3.1, Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: minidom xmlns not handling spaces in xmlns attribute value field
View: 12220
Assigned To: Nosy List: ideasman42, ned.deily
Priority: normal Keywords:

Created on 2011-03-20 05:47 by ideasman42, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
gnome-cpu-frequency-applet.svg ideasman42, 2011-03-20 05:47 svg, XML file.
Messages (3)
msg131479 - (view) Author: Campbell Barton (ideasman42) * Date: 2011-03-20 05:47
python3.2mu -c "import xml.dom.minidom ; xml.dom.minidom.parse('gnome-cpu-frequency-applet.svg')"

--- gives the following traceback
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.2/xml/dom/minidom.py", line 1939, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 924, in parse
    result = builder.parseFile(fp)
  File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, 0)
  File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 354, in first_element_handler
    self.start_element_handler(name, attributes)
  File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 779, in start_element_handler
    uri, localname, prefix, qname = _parse_ns_name(self, aname)
  File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 127, in _parse_ns_name
    uri, localname = parts
ValueError: too many values to unpack (expected 2)
msg131480 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-03-20 06:49
The .svg file you attached appears to have a faulty URI in it on line 4:

   xmlns:s="http://inkscape.sourceforge.net/DTD/s odipodi-0.dtd"

The error goes away if that space character is removed.  It might be nice for expatbuilder to provide a better diagnostic in this case but that's not likely to happen unless someone is interested in providing a patch.
msg137343 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-05-30 23:42
Issue12220 also addresses this problem in somewhat more detail.  Consolidating this issue with that one.
History
Date User Action Args
2022-04-11 14:57:15adminsetgithub: 55821
2011-05-30 23:42:07ned.deilysetstatus: open -> closed

superseder: minidom xmlns not handling spaces in xmlns attribute value field
resolution: duplicate
messages: + msg137343
2011-03-20 06:49:45ned.deilysetversions: + Python 3.1, Python 2.7, Python 3.3
nosy: + ned.deily

messages: + msg131480

type: crash ->
stage: needs patch
2011-03-20 05:47:28ideasman42create