[IPython-User] Running profile startup files in an embedded IPython instance
Sun Apr 8 14:07:52 CDT 2012
As discussed here <https://github.com/ipython/ipython/issues/1536>, startup
scripts/code are one way of initializing the namespace, while embedding in
a scope is another. It's unusual to do both, so there isn't an
official/convenient way to do this. Once you have started the embedded
session, you can run all your startup scripts yourself pretty easily:
import os, glob
for f in glob.glob(os.path.join(get_ipython().profile_dir.startup_dir,
%run -i $f
On Sun, Apr 8, 2012 at 10:16, Kevin Tran <firstname.lastname@example.org> wrote:
> I want to use an embedded IPython shell with a user_ns dictionary and a my
> profile configuration (ipython_config.py and the startup files). The
> purpose is to run a Django shell with models imported on startup.
> django-extensions implements a command called shell_plus that does this:
> from IPython import embed
> The problem is that this does not load my startup files. embed() calls
> load_default_config() which I figure loads ipython_config.py.
> How do I make the embedded IPython instance run my profile startup files?
> IPython-User mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-User