[lxml-dev] lxml

F Wolff friedel at translate.org.za
Fri Jul 24 11:18:09 CEST 2009


Op Vr, 2009-07-24 om 00:19 +0200 skryf Yassin Ezbakhe:
> 
> Hi, I'm using Python 2.6.2 (Windows) and lxml 2.2.2.
> 
> 
> When I run the following piece of code, it gets stuck.
> 
> 
> import lxml.etree as et
> s = "<root><a><b/><c/></a><d/><e/></root>"
> xml = et.fromstring(s)
> print xml[0] # prints element a
> print xml[2] # prints element e
> print xml[3] # it should raise an out of range exception, but it gets
> stuck
> 
> 
> What is the problem? In the original ElementTree implementation, I get
> an IndexError.

Hallo Yassin

I get the correct IndexError with lxml 2.1.5 in case that helps.

Friedel


--
Recently on my blog:
http://translate.org.za/blogs/friedel/en/content/firefox-35-released



More information about the lxml-dev mailing list