[IPython-User] Startup files don't get loaded when using embedded IPython (InteractiveShellEmbed)

Ingo Fischer mail@ingofischer...
Thu Jan 31 08:01:25 CST 2013


Hello *,

How can I load startup files when using embedded IPython 
(InteractiveShellEmbed)?
I tried ipython 0.13.1 and 0.14 dev.

This is a little script to test if startup files are loaded:

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    import os
    import IPython
    from IPython.frontend.terminal.embed import InteractiveShellEmbed

    homedir = os.environ['HOME']
    cfgfile = "%s/.config/ipython/profile_default/ipython_config.py" %
    homedir
    cfg = IPython.config.loader.PyFileConfigLoader(cfgfile).load_config()
    ipshell = InteractiveShellEmbed(config=cfg)
    ipshell()

Then I configured the startupfiles in my ipython_config:

    c.InteractiveShellApp.exec_files = ["/tmp/test.py"]

and I also tried

    c.InteractiveShellEmbed.exec_files = ["/tmp/tmpfile.py"]


Inside temp.py I have a little print statement.

When running IPython from the shell, the startup script is executed and 
the message is printed.
When running IPython in embedded mode, the message is *not* printed.

Seems that these configuration values are not picked up when running the 
embedded shell.
Does the embedded shell support startup scripts at all?

Cheers,
Ingo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20130131/2fa4c3d1/attachment.html 


More information about the IPython-User mailing list