Improve stack traces with the values associated with each argument in each frame.
Project description
ReprTraceback
ReprTraceback is a module that utilizes the sys.excepthook to throw custom traceback messages. Specifically, it includes values of positional, var, and keyword arguments.
Before & After
Before
Traceback (most recent call last):
File "main.py", line 17, in <module>
main()
File "main.py", line 13, in main
get_element(n, verbose, *args, **kwargs)
File "main.py", line 5, in get_element
return my_list[k]
~~~~~~~^^^
IndexError: list index out of range
# What is k? What was passed in? We'll never know. Hopefully it's easy to reproduce.
After
Traceback (most recent call last):
File "main.py", line 17, in <module>
main()
File "main.py", line 13, in main
main()
^^
File "main.py", line 5, in get_element
get_element(k=5, verbose=True, args=('my', 'var', 'args'), kwargs={'Repr': 'Traceback'})
^^^^^^^^^^
IndexError: list index out of range
Installation
You can install the project using pip:
pip install ReprTraceback
Usage
Import and Init ReprTraceback.
from ReprTraceback import ReprTraceback
# Call the init() function to set up the new traceback handler
ReprTraceback.init()
# ...
# Your code here
# ...
# When an exception occurs, the traceback will include the actual argument values
# passed to functions, providing better insight into the code flow and bug diagnosis.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ReprTraceback-1.0.4.tar.gz.
File metadata
- Download URL: ReprTraceback-1.0.4.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18bc895fffda16d2c7e7e1d25af073c1963c951498d57c6572aa9f03372cd7b2
|
|
| MD5 |
9afd9f85723ad8eaec61c82a75fd6514
|
|
| BLAKE2b-256 |
664c20727cee61f45f6fd15bb818559cd43af1fd400bd393f617134b9140cea5
|
File details
Details for the file ReprTraceback-1.0.4-py3-none-any.whl.
File metadata
- Download URL: ReprTraceback-1.0.4-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acd870476ed78e8059c444efda38cbfcaf186d5d6421be2966a8106324cb99f0
|
|
| MD5 |
230bbcae6f3b800c9ff9144790915d03
|
|
| BLAKE2b-256 |
61bf745a341af6bb706457d8aa127455615de390ada035fa32c1f282ca835f3a
|