Note
This documentation is for a development version of IPython. There may be significant differences from the latest stable release (1.2.1).
An embedded IPython shell.
Authors:
Bases: IPython.core.magic.Magics
%kill_embedded : deactivate for good the current embedded IPython.
This function (after asking for confirmation) sets an internal flag so that an embedded IPython will never activate again. This is useful to permanently disable a shell that is being called inside a loop: once you’ve figured out what you needed from it, you may then kill it and the program will then continue to run without the interactive shell interfering again.
Bases: IPython.terminal.interactiveshell.TerminalInteractiveShell
Embeds IPython into a running python program.
Parameters: | local_ns, module
stack_depth : int
compile_flags
|
---|
Call this to embed IPython at the current point in your program.
The first invocation of this will create an InteractiveShellEmbed instance and then call it. Consecutive calls just call the already created instance.
If you don’t want the kernel to initialize the namespace from the scope of the surrounding function, and/or you want to load full IPython configuration, you probably want IPython.start_ipython() instead.
Here is a simple example:
from IPython import embed
a = 10
b = 20
embed('First time')
c = 30
d = 40
embed
Full customization can be done by passing a Config in as the config argument.