Why does the raised exception not get printed out? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why does the raised exception not get printed out?

Exceptions https://code.sololearn.com/c2L2PAXydRWM/?ref=app

16th Apr 2021, 7:31 PM
Obinna Anosike
Obinna Anosike - avatar
2 Answers
+ 2
But if you look at the fourth line of the code, one side says or g
17th Apr 2021, 1:40 PM
Obinna Anosike
Obinna Anosike - avatar
0
If you are going to print the exception, it is better to use print(repr(e)) ; the base Exception. __str__ implementation only returns the exception message, not the type. Or, use the traceback module, which has methods for printing the current exception, formatted, or the full traceback. Regards, J Wick
1st Nov 2022, 6:21 AM
Jimmy Wick
Jimmy Wick - avatar