How to catch an exception in Python

Published: 05 July 2023
on channel: Python Morsels
267
14

Is your Python program printing out a traceback? You have an uncaught exception! You can catch that exception with a `try`-`except` block.

Read an article version of this video at https://pym.dev/how-to-catch-an-excep...

Find more Python screencasts at https://pym.dev/screencasts/

00:00 A program that counts TODOs in a file
00:58 Python prints a traceback for unhandled exceptions
01:21 Reading our traceback to figure out where the exception occurred
01:48 Handling an exception with a try-except block
02:57 Summary


Watch video How to catch an exception in Python online without registration, duration hours minute second in high quality. This video was added by user Python Morsels 05 July 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 26 once and liked it 1 people.