[IPython-User] Running profile startup files in an embedded IPython instance

MinRK benjaminrk@gmail....
Mon Apr 23 14:57:10 CDT 2012


On Mon, Apr 23, 2012 at 12:34, Kevin Tran <hekevintran@gmail.com> wrote:

> > Yes, %store is not a builtin magic but an extension, just load it when
> > you start:
> >
> > %load_ext storemagic
>
> I having trouble understanding the difference between embedded shells and
> non-embedded shells.
>
> I believe that my ipython_config.py is run when the embedded shell starts.
> In ipython_config.py I have `c.TerminalInteractiveShell.autocall = 1`. The
> autocall setting is respected by both embedded and non-embedded shells.
> When I remove the autocall setting, autocall doesn't work in embedded nor
> non-embedded shells. This makes sense to me.
>
> Why is it that by default %store is loaded in non-embedded shells (at
> least it is for me) and not in embedded shells? Is it because non-embedded
> shells have all the extension magic modules loaded and embedded shells do
> not?
>

This is simply because Extension config is attached to the Application,
rather than the Shell, which it shouldn't
be<https://github.com/ipython/ipython/issues/1144>.


The principal *functional* difference between an embedded shell and a
non-embedded one is that regular shells are children of Applications, and
embedded shells are not.  Things the Application does, then, are not
included in embedded shell setup.  This includes running startup files,
which makes sense, because embedded shells are initialized with a
particular namespace, and startup files are an alternative method for
initializing the namespace.

-MinRK



>
> Another strange thing about %store is that my stored values are not
> visible with %whos. %whos prints "Interactive namespace is empty." even
> though I have a macro that was stored and I can run the macro. A related
> thing is that after I load %store in an embedded shell, the macro is
> visible with %whos. Why is the macro not in the output of %whos in a
> non-embedded shell, but is there in an embedded shell? Or did I miss
> something else?
>
> Where is the list of extension magic modules?
>
> Thanks for the help.
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120423/f042663b/attachment.html 


More information about the IPython-User mailing list