Module Expr Str ImportFrom alias TryExcept body Expr NameLoad handlers ExceptHandler type NameLoad body Assign NameStore Num Assign NameStore Call NameLoad Assign NameStore AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr Str orelse Print Str Print Str Assign NameStore Call NameLoad Assign NameStore Num ImportFrom alias Assign NameStore Call NameLoad keyword NameLoad keyword Str keyword Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Str If UnaryOpNot NameLoad body Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr Str Assign NameStore Call NameLoad keyword NameLoad keyword Str Print Str Expr Call NameLoad Str Print Str Assign AttributeStore NameLoad attr Str Assign AttributeStore NameLoad attr Str FunctionDef arguments args NameParam defaults body Assign NameStore Str Expr Call NameLoad Str Print TupleLoad Str NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Str Expr Call NameLoad Str Print TupleLoad Str NameLoad decorator_list Print Str Expr Call NameLoad Str Assign AttributeStore NameLoad attr NameLoad Print Str Expr Call NameLoad Print Str Print Str Expr Call NameLoad keyword NameLoad Assign AttributeStore NameLoad attr NameLoad Print Str Expr Call NameLoad Print Str Expr Call NameLoad Str Print Str
N/A N/A An example of how to embed an IPython shell into a running program.

Please see the documentation in the IPython.Shell module for more details.

The accompanying file example-embed-short.py has quick code fragments for
embedding which you can cut and paste in your code once you understand how
things work.

The code in this file is deliberately extra-verbose, meant for learning. IPython.config.loader Config N/A N/A N/A get_ipython N/A N/A N/A NameError N/A N/A nested 0 N/A cfg N/A Config N/A shell_config N/A cfg InteractiveShellEmbed N/A N/A shell_config prompt_in1 In <\#>:  N/A N/A shell_config prompt_in2    .\D.:  N/A N/A shell_config prompt_out Out<\#>:  N/A N/A Running nested copies of IPython. N/A The prompts for the nested copy have been modified N/A cfg N/A Config N/A nested 1 IPython.frontend.terminal.embed InteractiveShellEmbed N/A ipshell N/A InteractiveShellEmbed config cfg banner1 Dropping into IPython exit_msg Leaving Interpreter, back to program. N/A cfg2 N/A N/A cfg copy N/A shell_config N/A cfg2 InteractiveShellEmbed N/A N/A shell_config prompt_in1 In2<\#>:  N/A N/A nested N/A N/A N/A shell_config prompt_in1 In2<\#>:  N/A N/A shell_config prompt_in2    .\D.:  N/A N/A shell_config prompt_out Out<\#>:  N/A ipshell2 N/A InteractiveShellEmbed config cfg banner1 Second IPython instance. N/A 
Hello. This is printed from the main controller program.
 N/A N/A ipshell ***Called from top level. Hit Ctrl-D to exit interpreter and continue program.
Note that if you use %kill_embedded, you can fully deactivate
This embedded instance so it will never turn on again N/A 
Back in caller program, moving along...
 N/A N/A ipshell banner Entering interpreter - New Banner N/A N/A ipshell exit_msg Leaving interpreter - New exit_msg foo N/A N/A m N/A N/A N/A s spam N/A N/A ipshell ***In foo(). Try %whos, or print s or m: N/A N/A foo says m =  m N/A bar N/A N/A n N/A N/A N/A s eggs N/A N/A ipshell ***In bar(). Try %whos, or print s or n: N/A N/A bar says n =  n N/A N/A Main program calling foo("eggs")
 N/A N/A foo eggs N/A N/A ipshell dummy_mode True N/A 
Trying to call IPython which is now "dummy": N/A N/A ipshell N/A Nothing happened... N/A 
Overriding dummy mode manually: N/A N/A ipshell dummy False N/A N/A ipshell dummy_mode False N/A You can even have multiple embedded instances: N/A N/A ipshell2 N/A 
Main program calling bar("spam")
 N/A N/A bar spam N/A Main program finished. Bye!