Asked By
shazaim
0 points
N/A
Posted on - 08/17/2019
I am a beginner in python. When I type in the standard python interpreter and if geta any errors, I get only a few lines of the error. I need the complete message sometimes so I can get a clearer picture. What should I do?
Simple (traceback) Errors In Standard Python 3.x
We all know the most common types of errors that we come across are syntax errors, logical errors, and exceptions. Python interpreter usually raises an exception whenever it encounters an error. The most usual kind is a traceback error.
So if you want to get more information about the error you encountered try the following.
import traceback
import sys
try:
do_stuff()
except Exception:
print(traceback.format_exec())
# or you can type the following, both will give you a clearer picture.
print(sys.exc_info()[0])