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: AttributesImpl does not implement __contains__ on Linux
Type: Stage:
Components: XML Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, jrbriggs
Priority: normal Keywords:

Created on 2006-12-13 00:24 by jrbriggs, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg30793 - (view) Author: Jason Briggs (jrbriggs) Date: 2006-12-13 00:24
Hi there

Had an odd error trying to run a utility called SVGMath:

File "/home/jason/downloads/SVGMath-0.3.1/svgmath/mathconfig.py", line 54, in startElement
    elif u"afm" in attributes:
  File "/usr/lib/python2.5/site-packages/_xmlplus/sax/xmlreader.py", line 316, in __getitem__
    return self._attrs[name]
KeyError: 0


It appears that AttributesImpl in the sax package (xmlreader.py) doesn't implement __contains__, so the 'in' operator throws an error.  This is on Kubuntu/Linux, so I'm not sure if it's distro-specific or all Linux versions of Python.

In any case, if you add:

    def __contains__(self, name):
        return self._attrs.has_key(name)

to AttributesImpl in xmlreader.py (as per the Windows version of Python), the problem goes away.

Kind regards
Jason
msg30794 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-12-15 22:23
It looks like the xmlreader.py doesn't come from the Python distribution, but from the PyXML library, which is maintained elsewhere.
msg30795 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-12-16 11:05
Reported in the PyXML tracker.
History
Date User Action Args
2022-04-11 14:56:21adminsetgithub: 44332
2006-12-13 00:24:55jrbriggscreate