A. Errors

When there is a problem with your code, Python responds with an error message. This is its attempt at explaining the problem. It might look something like this:

>>> print x
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in ?
    print x
NameError: name 'x' is not defined

The first few lines sometimes contain useful information about where Python thinks the error occured. If you are typing a module (rather than working interactively), click and hold the right mouse button and select go to file/line. This will take you to the line Python thinks is the problem. This is not always where the actual problem lies so analyse the last line of the error message too. This Appendix attempts to help you understand these messages.