Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python error get line

import sys
try:
    print(5/0)
except Exception as e:
    print('Error on line {}'.format(sys.exc_info()[-1].tb_lineno), type(e).__name__, e)

print('And the rest of program continues')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #error #line
ADD COMMENT
Topic
Name
5+1 =