Any way to get current file position in xml.parsers.expat?

C. Laurence Gonsalves clgonsal at
Fri Jul 13 18:22:51 CEST 2001

On Fri, 13 Jul 2001 07:30:52 GMT, Van Gale <cgale1 at> wrote:
>I'm pretty sure ErrorColumnNumber, ErrorLineNumber, and ErrorByteIndex
>are updated even when there is no error.

You're right, they do seem to get updated continuously. I didn't even
try checking this because the documentation explicitly says these values
won't be valid unless the parser raises an xml.parsers.expat.ExpatError

ie, says:

  The following attributes contain values relating to the most recent
  error encountered by an xmlparser object, and will only have correct
  values once a call to Parse() or ParseFile() has raised a
  xml.parsers.expat.ExpatError exception.

    Byte index at which an error occurred.


    Column number at which an error occurred.

    Line number at which an error occurred.

So is this an error in the documentation, or is the fact that these
values are continuousy updated merely a "quirk" in the current behaviour
that I shouldn't rely on because it may change at some point in the

I'd be much happier if the docs didn't say that I can't do what I want
to do...

  C. Laurence Gonsalves                "Any sufficiently advanced
  clgonsal at                     technology is indistinguishable          from magic." -- Arthur C. Clarke

More information about the Python-list mailing list