Tag: Exceptions & errors

  • Working with warnings in Python (Or: When is an exception not an exception?)

    It happens to all of us: You write some Python code, but you encounter an error: >>> for i in 10: # this will not work! print(i) TypeError: ‘int’ object is not iterable This isn’t just an error, but an exception. It’s Python’s way of saying that there was a problem in a defined way,…

    Read more

  • My favorite terrible Python error message

    Students in my Python classes occasionally get the following error message: TypeError: object() takes no parameters This error message is technically true, as I’ll explain in a moment. But it’s surprising and confusing for people who are new to Python, because it doesn’t point to the source of the actual problem. Here’s the basic idea:…

    Read more

  • How not to write an error message

    Users and programmers see error messages very differently. When a user sees an error message, they think, “Oh, no.  Something went wrong.”  Rarely, in my experience, does the user think to read the error message, or to use it as a clue toward what might have happened.  Technology is so opaque, so hard to understand,…

    Read more