Hi,
my use case for traceback_with_variables
is mainly during development time. Therefore I just need a small overview what was wrong with the variables that actually caused the exception.
My question is: how can I customize it that the extra output that traceback_with_variables
generates only comprises the very variables that lead to the exception?
Example:
Without using it, for this:
# from traceback_with_variables import activate_by_import
def main():
n = 0
x = 15
print(1 / n)
main()
I get:
/home/usesr/venv/numba/bin/python3.6 /home/usesr/PycharmProjects/myProject/attic04.py
Traceback (most recent call last):
File "/home/usesr/PycharmProjects/myProject/attic04.py", line 7, in <module>
main()
File "/home/usesr/PycharmProjects/myProject/attic04.py", line 5, in main
print(1 / n)
ZeroDivisionError: division by zero
Process finished with exit code 1
With using it, I get:
/home/usesr/venv/numba/bin/python3.6 /home/usesr/PycharmProjects/myProject/attic04.py
Traceback with variables (most recent call last):
File "/home/usesr/PycharmProjects/myProject/attic04.py", line 7, in <module>
main()
__name__ = '__main__'
__doc__ = None
__package__ = None
__loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x7f78c2d32f28>
__spec__ = None
__annotations__ = {}
__builtins__ = <module 'builtins' (built-in)>
__file__ = '/home/usesr/PycharmProjects/myProject/attic04.py'
__cached__ = None
activate_by_import = <module 'traceback_with_variables.activate_by_import' from '/home/usesr/venv/numba/lib/python3.6/site-packages/traceback_with_variables/activate_by_import.py'>
main = <function main at 0x7f78c2d58e18>
File "/home/usesr/PycharmProjects/myProject/attic04.py", line 5, in main
print(1 / n)
x = 15
n = 0
builtins.ZeroDivisionError: division by zero
Process finished with exit code 1
Would it be possible to configure it (at one place in my code) that I only get this output:
/home/usesr/venv/numba/bin/python3.6 /home/usesr/PycharmProjects/myProject/attic04.py
Traceback (most recent call last):
File "/home/usesr/PycharmProjects/myProject/attic04.py", line 7, in <module>
main()
File "/home/usesr/PycharmProjects/myProject/attic04.py", line 5, in main
print(1 / n)
n = 0
ZeroDivisionError: division by zero
Process finished with exit code 1
(so:
n = 0
lead to the exception, but
x = 15
was not part of the game.
As I have a lot of variables in my code, I get overwhelmed by the output and it takes me also time to find the value of the variable in the output that was causing the exception.
If I just could use a different import, that would be perfect for me :-) )