Problem with pyXML DOM

Maniac Maniac at SoftwareManiacs.Org
Wed May 4 07:14:38 EDT 2005


Florian Lindner wrote:

>Traceback (most recent call last):
>  File "ConfigReader.py", line 40, in ?
>    c = ConfigReader(f)
>  File "ConfigReader.py", line 32, in __init__
>    print sourceNode.getElementsByTagName("filename")[0].nodeValue()
>TypeError: 'NoneType' object is not callable
>  
>
This is because nodeValue here is 'None' and 'None()' doesn't make 
sense. Looks like you want the thing between <filename> and </filename>. 
This is not a nodeValue, this is nodeValue of firstChild of element 
'filename'. So this should work:

print sourceNode.getElementsByTagName("filename")[0].firstChild.nodeValue



More information about the Python-list mailing list