Skip to Main Content
Python Essentials For Dummies
book

Python Essentials For Dummies

by John C. Shovic, Alan Simpson
April 2024
Beginner content levelBeginner
192 pages
3h 46m
English
For Dummies
Audiobook available
Content preview from Python Essentials For Dummies

Chapter 9

Sidestepping Errors

IN THIS CHAPTER

Bullet Discovering exceptions

Bullet Finding out how to handle errors gracefully

Bullet Making sure your app doesn’t crash

Bullet Checking out try … except … else … finally

Bullet Learning to raise your own exceptions

We all want our programs to run perfectly all the time. But sometimes, situations in the real world stop a program from running. The problem isn’t with you or your program. Usually, the person using the program did something wrong. Error handling is all about anticipating these problems, catching the error, and then informing users of the problem so that they can fix it.

The techniques we describe here aren’t for fixing bugs in your code. You have to fix that type of error yourself. We’re talking strictly about errors in the environment in which the program is running, over which you have no control. Handling the error is simply a way of replacing the tech-speak error message that Python normally displays, which is meaningless to most people, with a message ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Essentials For Dummies

Python Essentials For Dummies

John C. Shovic, PhD, Alan Simpson
Introduction to Python

Introduction to Python

Jessica McKellar
Python for Data Science For Dummies, 3rd Edition

Python for Data Science For Dummies, 3rd Edition

John Paul Mueller, Luca Massaron
Python for Excel

Python for Excel

Felix Zumstein

Publisher Resources

ISBN: 9781394263479Purchase Link