Author Claudiu Saftoiu
Recipients Claudiu Saftoiu
Date 2016-07-18.19:31:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1468870264.4.0.689422874662.issue27565@psf.upfronthosting.co.za>
In-reply-to
Content
When debugging code that raises unexpected exceptions, I often find myself doing this:

    try:
        some_code
    except:
        import code; code.interact(local=locals())
        raise

My suggestion is a context manager to make this less verbose:

    with code.interact_on_error():
        some_code

The effect would be the same: if an exception is caught, `code.interact` is called with the locals of the function, and re-raised when `code.interact` ends.
History
Date User Action Args
2016-07-18 19:31:04Claudiu Saftoiusetrecipients: + Claudiu Saftoiu
2016-07-18 19:31:04Claudiu Saftoiusetmessageid: <1468870264.4.0.689422874662.issue27565@psf.upfronthosting.co.za>
2016-07-18 19:31:04Claudiu Saftoiulinkissue27565 messages
2016-07-18 19:31:04Claudiu Saftoiucreate