diff --git a/qt/applications/workbench/workbench/plugins/jupyterconsole.py b/qt/applications/workbench/workbench/plugins/jupyterconsole.py index 7226e26b17b93cafc30d340537a9202701c92eab..4fee6d842dfb03e3b9fd01e690c6d6983cb2f281 100644 --- a/qt/applications/workbench/workbench/plugins/jupyterconsole.py +++ b/qt/applications/workbench/workbench/plugins/jupyterconsole.py @@ -21,7 +21,11 @@ import sys # third-party library imports from mantidqt.widgets.jupyterconsole import InProcessJupyterConsole -from IPython.core.usage import quick_guide, release as ipy_release +try: + from IPython.core.usage import quick_guide +except ImportError: # quick_guide was removed in IPython 6.0 + quick_guide = '' +from IPython.core.usage import release as ipy_release from matplotlib import __version__ as mpl_version from numpy.version import version as np_version from qtpy.QtWidgets import QVBoxLayout diff --git a/qt/python/mantidqt/widgets/codeeditor/execution.py b/qt/python/mantidqt/widgets/codeeditor/execution.py index 990c348c2f44ebd0b7f1c2792897473c234f597e..e36cbb8105e6d708c7479a85e23222a7c5bb9241 100644 --- a/qt/python/mantidqt/widgets/codeeditor/execution.py +++ b/qt/python/mantidqt/widgets/codeeditor/execution.py @@ -149,7 +149,7 @@ class PythonCodeExecution(QObject): self._task = task return task - def execute(self, code_str, filename=''): + def execute(self, code_str, filename=None): """Execute the given code on the calling thread within the provided context. diff --git a/qt/python/mantidqt/widgets/codeeditor/inputsplitter.py b/qt/python/mantidqt/widgets/codeeditor/inputsplitter.py index 738a33a264cf76a5d1f28ba677c25d1a8aab5ff3..a13256d2309fa7a789f954ff56f751af9209eed9 100644 --- a/qt/python/mantidqt/widgets/codeeditor/inputsplitter.py +++ b/qt/python/mantidqt/widgets/codeeditor/inputsplitter.py @@ -68,7 +68,10 @@ class InputSplitter(IPyInputSplitter): if source.endswith('\\\n'): return False - self._update_indent(lines) + try: + self._update_indent(lines) + except TypeError: # _update_indent was changed in IPython 6.0 + self._update_indent() try: self.code = self._compile(source, symbol="exec") # Invalid syntax can produce any of a number of different errors from diff --git a/qt/python/mantidqt/widgets/codeeditor/test/test_execution.py b/qt/python/mantidqt/widgets/codeeditor/test/test_execution.py index 4c4c5f5960f278111dc6afa4f4f408b99b3d4db3..b0d6a5b7865644ca2882d7d21827ba53437ce2ab 100644 --- a/qt/python/mantidqt/widgets/codeeditor/test/test_execution.py +++ b/qt/python/mantidqt/widgets/codeeditor/test/test_execution.py @@ -111,7 +111,7 @@ class PythonCodeExecutionTest(unittest.TestCase): code = """ def foo(): def bar(): - # raises a NameError + \"""raises a NameError\""" y = _local + 1 # call inner bar() @@ -220,7 +220,7 @@ squared = sum*sum executor = PythonCodeExecution() self.assertRaises(expected_exc_type, executor.execute, code) - def _run_async_code(self, code, with_progress=False, filename=''): + def _run_async_code(self, code, with_progress=False, filename=None): executor = PythonCodeExecution() if with_progress: recv = ReceiverWithProgress()