[IPython-User] TerminalIPythonApp configuration fails without ipython_config.py

Thomas Kluyver takowl@gmail....
Sat Dec 15 12:25:38 CST 2012


Hi Pavol,

On 14 December 2012 22:38, Pavol Juhas <pavol.juhas@gmail.com> wrote:

> # ------------------------------------------------------------------------
> from IPython.frontend.terminal.ipapp import TerminalIPythonApp
> app = TerminalIPythonApp.instance()
> app.config.TerminalIPythonApp.pylab = 'auto'
> app.config.TerminalIPythonApp.pylab_import_all = True
> app.initialize(argv=[])
> app.shell.mainloop()
> # ------------------------------------------------------------------------
>
>
> If this code snippet is run with a non-existing IPYTHONDIR the
> pylab environment is not imported:
>
> mkdir /tmp/idir
> export IPYTHONDIR=/tmp/idir
> python launchpylab.py
> ...
> In [1]: plot
> ---------------------------------------------------------------------------
> NameError                                 Traceback (most recent call last)
>

I've replicated that, and I think you have spotted a bug - the action of
those config changes shouldn't depend on whether the config file exists.
Please do file an issue on Github so that we don't forget about it.

However, this is the recommended way to do configuration, and it does work
even with a fresh $IPYTHONDIR:

#
-----------------------------------------------------------------------------------------
from IPython.frontend.terminal.ipapp import TerminalIPythonApp
from IPython.config import Config
c = Config()
c.TerminalIPythonApp.pylab = 'auto'
c.TerminalIPythonApp.pylab_import_all = True

app = TerminalIPythonApp.instance(config=c)
app.initialize(argv=[])
app.shell.mainloop()
#
-----------------------------------------------------------------------------------------

Best wishes,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20121215/14875c79/attachment.html 


More information about the IPython-User mailing list