Skip to content

Use pre-mortem ipdb from inside IPython.embed #290

@anbjork

Description

@anbjork

When working with Python scripts that take a bit longer to run, I like to use
from IPython import embed; embed(colors = 'Linux')

From the embedded session, I often find myself wanting to step through functions to inspect what happens inside, and using the debugger for this would be fantastic since it would save me from editing them to put in additional embed()s, and pasting large chunks of code or reloading the modules if they come from a package.

However, I cannot make it work. When using
%debug [statement]
, it doesn't find things in my namespace and so I get NameError. When I use
ipdb.run('statement')
I get the error

You are currently into an embedded ipython shell,
the configuration will not be loaded.

Any advice, or an explanation of why what I want is impossible or not a good idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions