Package: tbdump
tbdump Packagetbdump - display helpful information for debbugging in case of errors/exceptionsDESCRIPTIONThis manual page documentstbdumpmodule, a Python module that displays
detailed information, which should be useful for debugging, when the Python
interpreter is aborted due to errors or traps.Python displays minimal information in case of errors such as the type of
exception and the line number of the source code where the program execution
is terminated.tbdumpreplaces the Python's hooksys.excepthookwhich
will be called when an exception is occured, so that more detailed information
on the program status (i.e., the location at which the exception occurred, all
variables and objects as well as their attributes defined in the scope), which
significantly helps your debugging.Also, at the exception,tbdumpinvokespdb, Python debugger.  So, you
can freely examine the state of the program using manypdbdebugger
commands.EXAMPLEBy default, Python tells little about the error.test.py:importsysfromcollectionsimportnamedtupleRecord=namedtuple('Record','name year size note')x=Record('John',2019,123,'Good')y=Record('Mike',2018,456)$python3test.py
Traceback(mostrecentcalllast):File"test.py",line6,in<module>y=Record('Mike',2018,456)TypeError:__new__()missing1requiredpositionalargument:'note'Withtbdump, you can have details.test-tbdump.py:importsysfromcollectionsimportnamedtupleimporttbdumpRecord=namedtuple('Record','name year size note')x=Record('John',2019,123,'Good')y=Record('Mike',2018,456)$python3test-tbdump.py
----<module>/tmp/foo.py4importtbdump56Record=namedtuple('Record','name year size note')7x=Record('John',2019,123,'Good')8y=Record('Mike',2018,456)Record=<class'__main__.Record'>_asdict<functionRecord._asdictat0x7ffff7383ee0>_field_defaults{}_fields('name','year','size','note')_make<classmethodobjectat0x7ffff737b970>_replace<functionRecord._replaceat0x7ffff7383dc0>name_tuplegetter(0,'Alias for field number 0')note_tuplegetter(3,'Alias for field number 3')size_tuplegetter(2,'Alias for field number 2')year_tuplegetter(1,'Alias for field number 1')__doc__'Record(name, year, size, note)'__getnewargs__<functionRecord.__getnewargs__at0x7ffff7383f70>__module__'__main__'__new__<staticmethodobjectat0x7ffff737b8e0>__repr__<functionRecord.__repr__at0x7ffff7383e50>__slots__()namedtuple=<functionnamedtupleat0x7ffff752e3a0>sys=...tbdump=...x=Record(name='John',year=2019,size=123,note='Good')__annotations__={}__builtins__=...__cached__=None__doc__=None__file__='/tmp/foo.py'__loader__=<_frozen_importlib_external.SourceFileLoaderobjectat0x7ff...name'__main__'path'/tmp/foo.py'__name__='__main__'__package__=None__spec__=None
TypeError:<lambda>()missing1requiredpositionalargument:'note'>/tmp/foo.py(8)<module>()->y=Record('Mike',2018,456)You are now in thepdbdebugger.  You can examine the internals:(Pdb)x
Record(name='John',year=2019,size=123,note='Good')(Pdb)x.name'John'(Pdb)Record
<class'__main__.Record'>(Pdb)list34importtbdump56Record=namedtuple('Record','name year size note')7x=Record('John',2019,123,'Good')8->y=Record('Mike',2018,456)[EOF](Pdb)INSTALLATIONpip3installtbdumpAVAILABILITYThe latest version oftbdumpmodule is available at
PyPI (https://pypi.org/project/tbdump/) .SEE ALSOpdb - The Python Debugger (https://docs.python.org/3.7/library/pdb.html)traceback - Print or retrieve a stack traceback (https://docs.python.org/3.7/library/traceback.html)AUTHORHiroyuki Ohsaki <ohsaki[atmark]lsnl.jp>