Python: Print StackTrace on Exception!

In this article we’ll be looking at printing just the StackTrace from the error message of an exception. We’ll see how to print it to the output screen and how to save it to a file. We will also see how to customize the message further for maximum efficiency. Without further ado, let’s begin! For … Read more

Python: Details contained in an Exception

In this article we’ll try to understand how to read an exception message and learn how to use the details/clues that are part of the exception message to debug our code effectively. For those of you in a hurry here is the short version of the answer. Details in an Exception Message: In a Nutshell … Read more

Print just the message of an exception

In this article let’s learn how to print just the message of an exception/error message. Whenever a Python program crashes with an exception we get a crazy long text trying to tell us what went wrong. In this article, we’ll explore how to print just the most useful part of that text, i.e. the “Exception … Read more

Python: Printing Exception Type

In this article we will learn how to print the “type” of an exception, that is the class name to which a given exception belongs to. Have you ever had your code crash and you were having difficulty debugging that and you said to yourself “If only I can print the damn Exception’s type I … Read more