From d4e3fbb08980140e958cd9de8ca02cd969b71b24 Mon Sep 17 00:00:00 2001 From: "ekaterina.itsenko" Date: Wed, 19 Jun 2024 22:02:25 +0200 Subject: [PATCH] [pycharm] PY-72059 Add an error displaying when numpy is not installed GitOrigin-RevId: 082917ec37b99955c9538ddf2154618f0a07fdaa --- python/pluginResources/messages/PyBundle.properties | 1 + .../python/debugger/containerview/PyDataViewerPanel.kt | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/python/pluginResources/messages/PyBundle.properties b/python/pluginResources/messages/PyBundle.properties index 15486aca0267..59a0512cb36c 100644 --- a/python/pluginResources/messages/PyBundle.properties +++ b/python/pluginResources/messages/PyBundle.properties @@ -744,6 +744,7 @@ debugger.data.view.close=Close debugger.data.view.resize.automatically=Resize automatically debugger.data.view.colored.cells=Colored cells debugger.data.view.failed.to.evaluate.expression=Failed to evaluate the expression {0} +debugger.data.view.numpy.is.not.available=NumPy is not available. Install the module for proper data display. debugger.data.view.type.is.not.supported={0} is not supported debugger.data.view.empty.tab=Empty debugger.numeric.view.as.dataframe=View as DataFrame diff --git a/python/src/com/jetbrains/python/debugger/containerview/PyDataViewerPanel.kt b/python/src/com/jetbrains/python/debugger/containerview/PyDataViewerPanel.kt index 5bb3b64694a4..c998e26b93bf 100644 --- a/python/src/com/jetbrains/python/debugger/containerview/PyDataViewerPanel.kt +++ b/python/src/com/jetbrains/python/debugger/containerview/PyDataViewerPanel.kt @@ -220,6 +220,12 @@ open class PyDataViewerPanel(@JvmField protected val project: Project, val frame catch (e: PyDebuggerException) { LOG.error(e) } + catch (e: Exception) { + if (e.message?.let { "Numpy is not available" in it } == true) { + setError(PyBundle.message("debugger.data.view.numpy.is.not.available", type), modifier) + } + LOG.error(e) + } } }