Python Errors And Exceptions

Syntax Errors

  • The parser repeats the offending line and displays a little ‘arrow’ pointing at the earliest point in the line where the error was detected.


  • Errors detected during execution are called exceptions and are not unconditionally fatal.
  • The try clause works as follows:
    • First the try clause is executed.
    • If no exception occurs, the except clause is skipped and the execution of the try statement is finished.
    • If an exception occurs during executing of the try clause, the rest of the clause is skipped. Then if its type matches the exception named after the except keyword, the expect clause is executed, and then execution continues after the try statement.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.