[IPython-dev] Best way to detect IPython notebook

TARUN GABA tarun.gaba7 at gmail.com
Thu Feb 20 11:45:33 EST 2014

I have written a method, which behaves differently when called from IPython
notebook, and from interpreter/qtconsole respectively.
I need to detect whether the method is called from notebook or interpreter.
This was the code I was using till now.

    if get_ipython().config['KernelApp']['parent_appname'] ==
        ##Do something

But I have came to know that this particular dict changes its format in
different IPython versions(I am not sure how many changes are there).

Is there any better method to achieve this?
Thanks in advance :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140220/3ca3c0ab/attachment.html>

More information about the IPython-dev mailing list