Automatically embed IPython into arbitrary stack frames in traceback.
# PyPI
pip3 install ei
# GitHub
pip3 install git+https://github.com.djosix/ei.git
Basic usage:
def main():
a = 123
b = 0
return a / b
if __name__ == '__main__':
import ei
ei.patch() # overwrites sys.excepthook
main()
Unpatch to recover sys.excepthook
:
ei.unpatch()
Context manager:
with ei.capture():
main()
# The exception hook is recovered here
Lazy patch:
import ei.patched