[IPython-dev] Best way to detect IPython notebook

TARUN GABA tarun.gaba7@gmail....
Thu Feb 20 10:45:33 CST 2014


Hi,
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'] ==
'ipython-notebook':
        ##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.scipy.org/pipermail/ipython-dev/attachments/20140220/3ca3c0ab/attachment.html 


More information about the IPython-dev mailing list