Skip to main content

tbdump Package

tbdump - display helpful information for debbugging in case of errors/exceptions

DESCRIPTION

This manual page documents tbdump module, 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. tbdump replaces the Python's hook sys.excepthook which 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, tbdump invokes pdb, Python debugger. So, you can freely examine the state of the program using many pdb debugger commands.

EXAMPLE

By default, Python tells little about the error.

test.py:

import sys
from collections import namedtuple

Record = namedtuple('Record', 'name year size note')
x = Record('John', 2019, 123, 'Good')
y = Record('Mike', 2018, 456)
$ python3 test.py
Traceback (most recent call last):
  File "test.py", line 6, in <module>
    y = Record('Mike', 2018, 456)
TypeError: __new__() missing 1 required positional argument: 'note'

With tbdump, you can have details.

test-tbdump.py:

import sys
from collections import namedtuple

import tbdump

Record = namedtuple('Record', 'name year size note')
x = Record('John', 2019, 123, 'Good')
y = Record('Mike', 2018, 456)
$ python3 test-tbdump.py
---- <module> /tmp/foo.py
    4 import tbdump
    5 
    6 Record = namedtuple('Record', 'name year size note')
    7 x = Record('John', 2019, 123, 'Good')
    8 y = Record('Mike', 2018, 456)
              Record = <class '__main__.Record'>
                     _asdict <function Record._asdict at 0x7ffff7383ee0>
             _field_defaults {}
                     _fields ('name', 'year', 'size', 'note')
                       _make <classmethod object at 0x7ffff737b970>
                    _replace <function Record._replace at 0x7ffff7383dc0>
                        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__ <function Record.__getnewargs__ at 0x7ffff7383f70>
                  __module__ '__main__'
                     __new__ <staticmethod object at 0x7ffff737b8e0>
                    __repr__ <function Record.__repr__ at 0x7ffff7383e50>
                   __slots__ ()
          namedtuple = <function namedtuple at 0x7ffff752e3a0>
                 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.SourceFileLoader object at 0x7ff...
                        name '__main__'
                        path '/tmp/foo.py'
            __name__ = '__main__'
         __package__ = None
            __spec__ = None
TypeError: <lambda>() missing 1 required positional argument: 'note'

> /tmp/foo.py(8)<module>()
-> y = Record('Mike', 2018, 456)

You are now in the pdb debugger. 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) list
  3  	
  4  	import tbdump
  5  	
  6  	Record = namedtuple('Record', 'name year size note')
  7  	x = Record('John', 2019, 123, 'Good')
  8  ->	y = Record('Mike', 2018, 456)
[EOF]
(Pdb) 

INSTALLATION

pip3 install tbdump

AVAILABILITY

The latest version of tbdump module is available at PyPI (https://pypi.org/project/tbdump/) .

SEE ALSO

pdb - 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)

AUTHOR

Hiroyuki Ohsaki <code[atmark]lsnl.jp>

Metadata

Release files for tbdump 1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tbdump 1.6
File Size Uploaded Provenance
tbdump-1.6.tar.gz 16.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tbdump 1.6
File Interpreter ABI Platform
tbdump-1.6-py3-none-any.whl Python 3 none any Details

Total release size: 34.2 kB

Release files / tbdump-1.6.tar.gz

Download URL tbdump-1.6.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8689d31dbf0b3dcb24b5a615890e2ee325a6bafec54f82929ab7539f3cd961ed
BLAKE2b-256 checksum
How to use checksums
3f765bcfb64b8ecef4b82365b6c54e5e135895e5dadb70f984e5d9b6af947660
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / tbdump-1.6-py3-none-any.whl

Download URL tbdump-1.6-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40006a374b87d5635aca7dcd17d0bbd813dc9f66d41a8c7cdc240c48eeab4a3d
BLAKE2b-256 checksum
How to use checksums
2f31b580a0855e8c8602282decac22088c67c187a9456e4b4c4a1b7b4897e220
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for tbdump 1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page