ipdb does not have a buitl-in command for this, so let's try using sys.exc_info():
Ok, let's ask on Stackoverflow. And here is the solution: put
alias exc_info !import sys; sys.exc_info() %1
into
~/.pdbrc
Now:
> /home/vic/projects/test.py(4)<module>() 2 1/0 3 except: ----> 4 import ipdb; ipdb.set_trace() ipdb> import sys; sys.exc_info() (<type 'exceptions.AttributeError'>, AttributeError("Pdb instance has no attribute 'do_import'",), <traceback object at 0x2341bd8>) ipdb>
alias exc_info !import sys; sys.exc_info() %1
~/.pdbrc
> /home/vic/projects/test.py(4)<module>() 2 1/0 3 except: ----> 4 import ipdb; ipdb.set_trace() ipdb> exc_info (<type 'exceptions.ZeroDivisionError'>, ZeroDivisionError('integer division or modulo by zero',), <traceback object at 0x7fe8dc7909e0>) ipdb>
No comments:
Post a Comment