From ed264802a2d9e7cab0846e75a7a028e332e99def Mon Sep 17 00:00:00 2001 From: Kenneth Lyons Date: Mon, 23 Sep 2019 21:19:01 -0700 Subject: [PATCH 1/2] Raise AttributeError in __getattr__ --- pyqtgraph/graphicsWindows.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyqtgraph/graphicsWindows.py b/pyqtgraph/graphicsWindows.py index b6598685..f1315005 100644 --- a/pyqtgraph/graphicsWindows.py +++ b/pyqtgraph/graphicsWindows.py @@ -48,7 +48,7 @@ class TabWindow(QtGui.QMainWindow): if hasattr(self.cw, attr): return getattr(self.cw, attr) else: - raise NameError(attr) + raise AttributeError(attr) class PlotWindow(PlotWidget): From b57d45df6de3eaafcb0b50017d3d8badb6d2f05e Mon Sep 17 00:00:00 2001 From: Kenneth Lyons Date: Mon, 23 Sep 2019 21:25:52 -0700 Subject: [PATCH 2/2] The lazier way --- pyqtgraph/graphicsWindows.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pyqtgraph/graphicsWindows.py b/pyqtgraph/graphicsWindows.py index f1315005..b6a321ee 100644 --- a/pyqtgraph/graphicsWindows.py +++ b/pyqtgraph/graphicsWindows.py @@ -45,10 +45,7 @@ class TabWindow(QtGui.QMainWindow): self.show() def __getattr__(self, attr): - if hasattr(self.cw, attr): - return getattr(self.cw, attr) - else: - raise AttributeError(attr) + return getattr(self.cw, attr) class PlotWindow(PlotWidget):