Daniel Nogradi wrote:

> According to the documentation the xml.parsers.expat module provides
> the exception ExpatError and this exception has 3 attributes, lineno, offset
> and code. I would like to use lineno, but can't.

> try:
>     minidom.parse("my.xml")
> except ExpatError:
>     print 'The file my.xml is not well-formed.'
>     print 'And the problem is here: ', ExpatError.lineno

you're supposed to look at the exception instance, not the class
that defines it:

try:
    minidom.parse("my.xml")
except ExpatError, v:
    print 'The file my.xml is not well-formed.'
    print 'And the problem is here: ', v.lineno

more here:

    http://docs.python.org/tut/node10.html

</F> 



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to