Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions Doc/library/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,25 @@ The following exceptions are the exceptions that are usually raised.
or :func:`eval`, or when reading the initial script or standard input
(also interactively).

Instances of this class have attributes :attr:`filename`, :attr:`lineno`,
:attr:`offset` and :attr:`text` for easier access to the details. :func:`str`
of the exception instance returns only the message.
The :func:`str` of the exception instance returns only the error message.

.. attribute:: filename

The name of the file the syntax error occurred in.

.. attribute:: lineno

Which line number in the file the error occurred in. Note that this is
1-indexed, the first line in the file would have a ``lineno`` of 1.

.. attribute:: offset

The column in the line where the error occurred. Note that this is
1-indexed, the first character in the line has an ``offset`` of 1.

.. attribute:: text

The source code text involved in the error.


.. exception:: IndentationError
Expand Down