简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM