When something goes wrong, Python throws an exception. For example, trying to divide a number by 0 won't work. If the exception is not handled, it will end the execution.
In the next simple example, Python will print the string before the division, then it will throw an exception, printing it to the standard error, which happens to be the screen by default, and then nothing. The script stops working and the string "after" is not printed.
#!/usr/bin/env python from __future__ import print_function a = 1 b = 0 print("before") print(a/b) print("after") # before # Traceback (most recent call last): # File "divide_by_zero.py", line 7, in <module> # print(a/b) # ZeroDivisionError: integer division or modulo by zero