Message270786
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. |
|
Date |
User |
Action |
Args |
2016-07-18 19:31:04 | Claudiu Saftoiu | set | recipients:
+ Claudiu Saftoiu |
2016-07-18 19:31:04 | Claudiu Saftoiu | set | messageid: <1468870264.4.0.689422874662.issue27565@psf.upfronthosting.co.za> |
2016-07-18 19:31:04 | Claudiu Saftoiu | link | issue27565 messages |
2016-07-18 19:31:04 | Claudiu Saftoiu | create | |
|