Skip to content

djosix/ei

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ei

Automatically embed IPython into arbitrary stack frames in traceback.

asciicast

Install

# PyPI
pip3 install ei

# GitHub
pip3 install git+https://hub.apw.app.djosix/ei.git

Usage

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

About

Embed IPython to rescue your code.

Resources

License

Stars

Watchers

Forks

Languages