| Home | Trees | Indices | Help |
|---|
|
|
object --+
|
exceptions.BaseException --+
|
exceptions.Exception --+
|
ParseBaseException --+
|
ParseException
Exception thrown when parse expressions don't match class;
supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text
Example::
try:
Word(nums).setName("integer").parseString("ABC")
except ParseException as pe:
print(pe)
print("column: {}".format(pe.col))
prints::
Expected integer (at char 0), (line:1, col:1)
column: 1
|
|||
|
Inherited from Inherited from Inherited from Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|||
|
|||
Method to take an exception and translate the Python internal traceback into a list of the pyparsing expressions that caused the exception to be raised. Parameters:
Returns a multi-line string listing the ParserElements and/or function names in the exception's stack trace. Note: the diagnostic output will include string representations of the expressions that failed to parse. These representations will be more helpful if you use `setName` to give identifiable names to your expressions. Otherwise they will use the default string forms, which may be cryptic to read. explain() is only supported under Python 3. |
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Wed Dec 25 07:03:29 2019 | http://epydoc.sourceforge.net |