On 02.09.2015 07:58, Luyao Huang wrote: > https://bugzilla.redhat.com/show_bug.cgi?id=1222795#c6 > > if build libvirt-python with some old xml lib (python-pyxml), > build will fail and error like this: > > File "generator.py", line 139, in start > if "string" in attrs: > File "/usr/local/lib/python2.7/site-packages/_xmlplus/sax/xmlreader.py" \ > , line 316, in __getitem__ > return self._attrs[name] > KeyError: 0 > > This is an old issue and have been mentioned in commit 3ae0a76d. > There is no __contains__ in class AttributesImpl, python will use > __getitem__ in this place, so we will get error. > Let's use 'YYY in XXX.keys()' to avoid this issue. > > Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx> > --- > generator.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/generator.py b/generator.py > index 2fc838c..d9ae17e 100755 > --- a/generator.py > +++ b/generator.py > @@ -136,7 +136,7 @@ class docParser(xml.sax.handler.ContentHandler): > elif attrs['file'] == "libvirt-qemu": > qemu_enum(attrs['type'],attrs['name'],attrs['value']) > elif tag == "macro": > - if "string" in attrs: > + if "string" in attrs.keys(): > params.append((attrs['name'], attrs['string'])) > > def end(self, tag): > ACKed and pushed. Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list