[IPython-dev] How to know if code is executing in a rich display (qtconsole or notebook)
Kiko
kikocorreoso at gmail.com
Fri Feb 26 04:59:38 EST 2016
Hi all,
Is there a sane way to know if some code is executing in a rich display
environment like the qtconsole or the notebook?
I think the following could work:
try:
from ipykernel.zmqshell import ZMQInteractiveShell
ip = get_ipython()
rich_display = isinstance(ip, ZMQInteractiveShell)
except:
rich_display = False
Thanks!!
Best.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20160226/523434cf/attachment.html>
More information about the IPython-dev
mailing list