I was debugging my python script and came across traceback<\/code> object, which is present at 2nd index in result, returned by
sys.exc_info()<\/code> function.
However, I tried to google out information related to
traceback<\/code> object, but everywhere i got link to
traceback module<\/code> in standard python lib.
Then, I tried doing
dir()<\/code> on traceback object, which gives me a list of attributes.
In that list, following attributes looks interesting :-
1. tb_frame,
2. tb_lasti,
3. tb_lineno,
4. tb_next
As specified by in docpage specified by @vaultah,
These all are special read-only attributes.
tb_next
is the next level in the stack trace (towards the frame where the exception occurred), or None if there is no next level; tb_frame
points to the execution frame of the current level; tb_lineno
gives the line number where the exception occurred; tb_lasti
indicates the precise instruction. Note :- The line number and last instruction in the traceback may differ from the line number of its frame object if the exception occurred in a try statement with no matching except clause or with a finally clause.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.