Gere
Gere

Reputation: 12687

Inspect variables after exception in Python/Pydev/Eclipse

Can I inspect variables on the stack after there is an uncaught exception in Python/Pydev/Eclipse? I'd like to go back in stack levels and see the local variables.

I suppose there are ways to hack this in Python, but is there an easy way in Eclipse?

Upvotes: 4

Views: 423

Answers (1)

Bastian Venthur
Bastian Venthur

Reputation: 16550

You don't have to 'hack' this into python, you just use ipython:

ipython yourscript.py --pdb

whenever 'yourscript.py' crashes, you'll land in the ipython debugger on the spot where the exception was raised. From there you can move the stack up and down and inspect the variables etc. as needed. Thanks to ipython you'll even have tab-completion.

Sure enough it's not Eclipse but it straightforward and incredibly useful when developing in Python.

Upvotes: 1

Related Questions