Skip to content

A simple solution to analyze and extract information from traceback

License

Notifications You must be signed in to change notification settings

GraiaCommunity/Unwind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unwind

A simple solution to analysis and extract information from traceback

install

pip install unwind

usage

from unwind import Report

with Report() as report:
    a = 1
    b = 2
    c = 'a'
    d = 1 + c

print(report.errors[0])
print(report.reports[0])

'''
(<class 'TypeError'>, TypeError("unsupported operand type(s) for +: 'int' and 'str'"), <traceback object at xxxxx>)
---------report--------
info = TraceContext(
    file='D:/Download/Projects/Unwind/example.py'
    line=59
    name='<module>'
####====context====####
    b = 2
    c = 'a'
    d = 1 + c

print(report.errors[0])
####====context====####
    error_line='d = 1 + c'
    locals={'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x0000020F11200910>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, '__file__': 'D:/Download/Projects/Unwind/example.py', '__cached__': None, 'Report': <class 'unwind.main.Report'>, 'report': <unwind.main.Report object at 0x0000020F112D86D0>, 'a': 1, 'b': 2, 'c': 'a'}
)
flag = operate
args = {'c': 'a'}
---------end------
'''

or

from unwind import get_report

try:
    a = 1
    b = 2
    c = 'a'
    d = 1 + c
except Exception as e:
    print(get_report(e))

About

A simple solution to analyze and extract information from traceback

Topics

Resources

License

Stars

Watchers

Forks

Languages