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

Van Gale cgale1 at
Fri Jul 13 03:30:52 EDT 2001

"C. Laurence Gonsalves" <clgonsal at> wrote in
message news:slrn9kt86i.750.clgonsal at
> Unfortunately, I can't find any way to get the current position in the
> file when using ParseFile. I know that if expat throws an ExpatError,
> that will contain the line and column number, but that doesn't help me
> in this situation, as the file is 'well formed' XML as far as expat is
> concerned.
> So is there any way to ask the expat parser where it is in the file?
> Even a byte offset from the beginning of the file would be better than
> nothing.

I'm pretty sure ErrorColumnNumber, ErrorLineNumber, and ErrorByteIndex are
updated even when there is no error.


More information about the Python-list mailing list