diff --git a/Framework/PythonInterface/mantid/__init__.py b/Framework/PythonInterface/mantid/__init__.py index 1e756bc460ef..b76a24c27754 100644 --- a/Framework/PythonInterface/mantid/__init__.py +++ b/Framework/PythonInterface/mantid/__init__.py @@ -48,7 +48,8 @@ def apiVersion(): ############################################################################### import warnings as _warnings # Default we see everything -_warnings.filterwarnings("default",category=DeprecationWarning) +_warnings.filterwarnings("default",category=DeprecationWarning, + module="mantid.*") # We can't do anything about numpy.oldnumeric being deprecated but # still used in other libraries, e.g scipy, so just ignore those _warnings.filterwarnings("ignore",category=DeprecationWarning, diff --git a/MantidPlot/ipython_widget/mantid_ipython_widget.py b/MantidPlot/ipython_widget/mantid_ipython_widget.py index 0ac7c5557306..344828b31860 100644 --- a/MantidPlot/ipython_widget/mantid_ipython_widget.py +++ b/MantidPlot/ipython_widget/mantid_ipython_widget.py @@ -4,6 +4,7 @@ import inspect import threading import types +import warnings from PyQt4 import QtGui @@ -14,8 +15,20 @@ # Monkeypatch! RegexLexer.get_tokens_unprocessed_unpatched = RegexLexer.get_tokens_unprocessed -from IPython.qt.console.rich_ipython_widget import RichIPythonWidget -from IPython.qt.inprocess import QtInProcessKernelManager +# Ignore Jupyter/IPython deprecation warnings that we can't do anything about +warnings.filterwarnings('ignore', category=DeprecationWarning, module='IPython.*') +warnings.filterwarnings('ignore', category=DeprecationWarning, module='ipykernel.*') +warnings.filterwarnings('ignore', category=DeprecationWarning, module='jupyter_client.*') +warnings.filterwarnings('ignore', category=DeprecationWarning, module='qtconsole.*') +del warnings + +try: + # Later versions of Qtconsole are part of Jupyter + from qtconsole.rich_jupyter_widget import RichJupyterWidget as RichIPythonWidget + from qtconsole.inprocess import QtInProcessKernelManager +except ImportError: + from IPython.qt.console.rich_ipython_widget import RichIPythonWidget + from IPython.qt.inprocess import QtInProcessKernelManager def our_run_code(self, code_obj, result=None): """ Method with which we replace the run_code method of IPython's InteractiveShell class.