Re: [xml] Python,, scope

On Mon, Feb 24, 2003 at 03:04:42PM -0500, Michael Rothwell wrote:
In the code snippet below (infinite loop prevention and error checking 
code removed), lines 3 and 4 work properly, and print the node name. 
Line 6, however, yields the following error:

AttributeError: 'NoneType' object has no attribute 'name'

Is this a scope problem? A bug? What am I doing wrong? It seems to me 
that line 6 should work if line 3 does.

1: doc = libxml2.recoverDoc(text)
2: node = doc.children
3: name =
4: print "Node:" + name
5: while 1:
6:   name =
7:   if != 'text': break

  I can't reproduce this. For some reason node became None probably
due to some of the removed code.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]