Module pyparsing :: Class ParseException |
[frames] | no frames]

# Class ParseException

source code

                  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

Instance Methods
Inherited from `ParseBaseException`: `__dir__`, `__getattr__`, `__init__`, `__repr__`, `__str__`, `markInputline` Inherited from `exceptions.Exception`: `__new__` Inherited from `exceptions.BaseException`: `__delattr__`, `__getattribute__`, `__getitem__`, `__getslice__`, `__reduce__`, `__setattr__`, `__setstate__`, `__unicode__` Inherited from `object`: `__format__`, `__hash__`, `__reduce_ex__`, `__sizeof__`, `__subclasshook__`

Properties
Inherited from `exceptions.BaseException`: `args`, `message` Inherited from `object`: `__class__`