Debugging Python script in ipython

Source: Internet
Author: User
Ipython doesn' t work with built-in PDB debugger. while I tried to debug a Python script" Run-D script. py "Within ipython shell, I got bellow error: Attributeerror: PDB instance has no attribute 'curframework'

To debug script in ipython, we need to use a different debugger, pydb, for example. There are only three steps to setup and use it.

    1. Download and install pydb.
    2. Start ipython with-pydb argument:Ipython-pydb
    3. Start debugging:Run-D script. py

It's mandatory to set home environment variable to use pydb. On my windows box, there is no home environment variable set by default, and I got bellow error:Keyerror: 'home'

It can be solved by adding home environment variable.

Because pydb use the same set of commands with GDB, it's fairly straightforward to get start with it if you have done some debugging in GDB. this is one reason why I pick it as my debugger.

Reference:
Introducing the pydb Debugger
Debugging in Python

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.