diff --git a/bec_widgets/widgets/plots_next_gen/toolbar_bundles/plot_export.py b/bec_widgets/widgets/plots_next_gen/toolbar_bundles/plot_export.py index 7fd5f22a..ffb3fa72 100644 --- a/bec_widgets/widgets/plots_next_gen/toolbar_bundles/plot_export.py +++ b/bec_widgets/widgets/plots_next_gen/toolbar_bundles/plot_export.py @@ -1,3 +1,5 @@ +import traceback + from pyqtgraph.exporters import MatplotlibExporter from bec_widgets.qt_utils.error_popups import SafeSlot, WarningPopupUtility @@ -60,7 +62,7 @@ class PlotExportBundle(ToolbarBundle): import matplotlib as mpl MatplotlibExporter(self.target_widget.plot_item).export() - except: + except ModuleNotFoundError: warning_util = WarningPopupUtility() warning_util.show_warning( title="Matplotlib not installed", @@ -68,3 +70,12 @@ class PlotExportBundle(ToolbarBundle): detailed_text="Please install matplotlib in your Python environment by using 'pip install matplotlib'.", ) return + except TypeError: + warning_util = WarningPopupUtility() + error_msg = traceback.format_exc() + warning_util.show_warning( + title="Matplotlib TypeError", + message="Matplotlib exporter could not resolve the plot item.", + detailed_text=error_msg, + ) + return