<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Return/display an object that a repr text, html and JavaScript.</div><div><br></div><div>Text in console can be copy pasted, html in qtconsole will be clickable. Js in notebook will open a new tab (or a new window) depending on user preferences.</div><div><br></div><div>I find irritating that libs open a tab for me, wether I am in console or browser already. I would'nt implement  the js part if it was me.</div><div><br></div><div>Envoyé de mon iPhone</div><div><br>Le 21 févr. 2014 à 06:41, TARUN GABA <<a href="mailto:tarun.gaba7@gmail.com">tarun.gaba7@gmail.com</a>> a écrit :<br><br></div><blockquote type="cite"><div><p dir="ltr">So the function I mention is supposed to open the browser with a specific url.<br>
Now if it is called from ipython notebook,  a browser is already open, so it simply opens up a new tab.<br>
If the method is called from command line interpreter or qtconsole instead of popping up a browser window (some people find it irritating), we can display a message that requests them to manually open browser and move to that url. What is the best approach for this?</p>

<div class="gmail_quote">On 20 Feb 2014 23:35,  <<a href="mailto:ipython-dev-request@scipy.org">ipython-dev-request@scipy.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Send IPython-dev mailing list submissions to<br>
        <a href="mailto:ipython-dev@scipy.org">ipython-dev@scipy.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:ipython-dev-request@scipy.org">ipython-dev-request@scipy.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:ipython-dev-owner@scipy.org">ipython-dev-owner@scipy.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of IPython-dev digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Best way to detect IPython notebook (TARUN GABA)<br>
   2. Re: Best way to detect IPython notebook (Matthias BUSSONNIER)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Thu, 20 Feb 2014 22:15:33 +0530<br>
From: TARUN GABA <<a href="mailto:tarun.gaba7@gmail.com">tarun.gaba7@gmail.com</a>><br>
Subject: [IPython-dev] Best way to detect IPython notebook<br>
To: <a href="mailto:ipython-dev@scipy.org">ipython-dev@scipy.org</a><br>
Message-ID:<br>
        <CAHAono2LZ=DfeBRL-Y3k0J6c=<a href="mailto:UdE_pUX19ZTYAxLQMyZMi3AdA@mail.gmail.com">UdE_pUX19ZTYAxLQMyZMi3AdA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
Hi,<br>
I have written a method, which behaves differently when called from IPython<br>
notebook, and from interpreter/qtconsole respectively.<br>
I need to detect whether the method is called from notebook or interpreter.<br>
This was the code I was using till now.<br>
<br>
    if get_ipython().config['KernelApp']['parent_appname'] ==<br>
'ipython-notebook':<br>
        ##Do something<br>
<br>
But I have came to know that this particular dict changes its format in<br>
different IPython versions(I am not sure how many changes are there).<br>
<br>
Is there any better method to achieve this?<br>
Thanks in advance :)<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://mail.scipy.org/pipermail/ipython-dev/attachments/20140220/3ca3c0ab/attachment-0001.html" target="_blank">http://mail.scipy.org/pipermail/ipython-dev/attachments/20140220/3ca3c0ab/attachment-0001.html</a><br>

<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Thu, 20 Feb 2014 18:17:54 +0100<br>
From: Matthias BUSSONNIER <<a href="mailto:bussonniermatthias@gmail.com">bussonniermatthias@gmail.com</a>><br>
Subject: Re: [IPython-dev] Best way to detect IPython notebook<br>
To: IPython developers list <<a href="mailto:ipython-dev@scipy.org">ipython-dev@scipy.org</a>><br>
Message-ID: <<a href="mailto:6CC95483-B554-40C9-91AB-DB63FCDE0AA3@gmail.com">6CC95483-B554-40C9-91AB-DB63FCDE0AA3@gmail.com</a>><br>
Content-Type: text/plain; charset=iso-8859-1<br>
<br>
Hi,<br>
<br>
Le 20 f?vr. 2014 ? 17:45, TARUN GABA a ?crit :<br>
<br>
> Hi,<br>
> I have written a method, which behaves differently when called from IPython notebook, and from interpreter/qtconsole respectively.<br>
> I need to detect whether the method is called from notebook or interpreter.<br>
> This was the code I was using till now.<br>
><br>
>     if get_ipython().config['KernelApp']['parent_appname'] == 'ipython-notebook':<br>
>         ##Do something<br>
><br>
> 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).<br>
><br>
> Is there any better method to achieve this?<br>
<br>
You should describe what you ment by "called from a notebook"<br>
it is not clear enough to give a correct answer.<br>
<br>
But if the question is the same as usual, and as stated in many discussion scattered<br>
over the net and mailing list, there is no, and there will be no reliable way to detect which<br>
frontend are requiring code execution, as there is no reason for a kernel to be connected<br>
to only one frontend.<br>
<br>
It is like a book writer asking "how can I make the eye color of my main character the same as my reader" ?<br>
The question make no sense as two person can be reading the same page of the same book at the same time.<br>
<br>
And as usual, if you describe what you are trying to archive instead of how,<br>
you might get an answer that suit you.<br>
<br>
<br>
Cheers,<br>
--<br>
Matthias<br>
<br>
<br>
<br>
<br>
> Thanks in advance :)<br>
> _______________________________________________<br>
> IPython-dev mailing list<br>
> <a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
> <a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br>
<br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br>
<br>
End of IPython-dev Digest, Vol 121, Issue 28<br>
********************************************<br>
</blockquote></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>IPython-dev mailing list</span><br><span><a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a></span><br><span><a href="http://mail.scipy.org/mailman/listinfo/ipython-dev">http://mail.scipy.org/mailman/listinfo/ipython-dev</a></span><br></div></blockquote></body></html>