On this page
pyexpat.ExpatError
Prev: pyexpat.ErrorString | Up: pyexpat | Next: pyexpat.ParserCreate
Rel: pyexpat.error, pyexpat.ErrorString, pyexpat.ParserCreate, pyexpat.XMLParserType
Ref: docs.python.org โ pyexpat.ExpatError
Tags: #public #python3 #stdlib #pyexpat
Import
import pyexpat
from pyexpat import ExpatError
Signature & Overview
pyexpat.ExpatError(...)
pyexpat.ExpatError class.
Methods & Attributes
ExpatError.add_note(self, note, /)โ Add a note to the exceptionExpatError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import pyexpat
p = pyexpat.ParserCreate()
try:
p.Parse(b"<broken>", True)
except pyexpat.ExpatError as exc:
assert exc.lineno == 1
Gotchas
- Inspect
exc.code,exc.lineno, andexc.offsetfor exact XML parse error locations.
REPL Inspect
from pyexpat import ExpatError
help(ExpatError)
Linked from
Related notes
- tuts/python3/stdlib_module/pyexpat/error Linked here; links to this page; shared tags: #pyexpat, #stdlib
- tuts/python3/stdlib_module/pyexpat/ErrorString Linked here; links to this page; shared tags: #pyexpat, #stdlib
- tuts/python3/stdlib_module/pyexpat/ParserCreate Linked here; links to this page; shared tags: #pyexpat, #stdlib
- tuts/python3/stdlib_module/pyexpat/XMLParserType Linked here; links to this page; shared tags: #pyexpat, #stdlib
- tuts/python3/stdlib_module/pyexpat Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib