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

Pavol Juhas pavol.juhas@gmail....
Fri Dec 14 16:38:00 CST 2012


Hello,

I have been working on a small data-processing application that
has an option to start IPython/pylab to let the users plot and investigate
results.  I ran into the following problem, which usually bites new users
who don't have any ipython profile files:

The pylab configuration that is setup within my application is ignored
unless ipython_config.py exists and it sets some parameter - even if
assigned a default value.

Here is the code that starts ipython/pylab from my application,
(same in the attachment):

# ------------------------------------------------------------------------
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)

Creating the default profile file does not help, because all lines in
ipython_config.py are commented out:

ipython profile create
python launchpylab.py

(still does not work).  However, if any line in ipython_config.py is
active, say by uncommenting the
c.InteractiveShellApp.code_to_run = ''
line, everything works well and the launchpylab.py script
obeys the pylab and pylab_import_all settings.
This problem occurs in IPython 0.11-0.13 on MacOSX,
Linux and Windows.

Is there some workaround to this issue?

I would prefer if my users got a full functionality without
having to fiddle with the ipython_config.py file; many
of them have never used IPython.

Thank you,

Pavol
-------------- next part --------------
A non-text attachment was scrubbed...
Name: launchpylab.py
Type: application/octet-stream
Size: 265 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/ipython-user/attachments/20121214/c72ed3dd/attachment.obj 


More information about the IPython-User mailing list