#100DaysOfCode in Python Transcripts
Chapter: Days 25-27: Error handling
Lecture: Introducing Python's error handling
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Probably time that we talked about error handling.
0:02
I'm sure that you've encountered some issues
0:05
with your Python code and you may wonder
0:08
what is the right way to catch these errors in Python.
0:12
Well, that's what this next three day section is all about.
0:16
Have you encountered Python's errors?
0:18
Have you seen what's called a traceback here?
0:21
This is the report from trying to run the Python program
0:25
when something actually went wrong on line 21 of api.py.
0:30
Let me get a little info here,
0:31
there's a type error : and this
0:34
gives us a description of what that is.
0:35
The type thing on the left here, the type error
0:37
is an exception type and it tells us the category of error.
0:41
On the right is the actual message
0:43
of what went wrong within that category.
0:45
So None type, object is not iterable.
0:48
Turns out that in this case, the data return
0:51
from the server was empty and we tried to loop over it.
0:53
That doesn't work so well.
0:55
So we're going to see how to deal with a variety of errors
0:58
the proper way in Python.