summaryrefslogtreecommitdiff
path: root/gnuradio-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/hier_block2.py2
-rw-r--r--gnuradio-core/src/python/gnuradio/gr/top_block.py2
2 files changed, 4 insertions, 0 deletions
diff --git a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
index 3d3545a28..b43c5feda 100644
--- a/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
+++ b/gnuradio-core/src/python/gnuradio/gr/hier_block2.py
@@ -45,6 +45,8 @@ class hier_block2(object):
"""
Pass-through member requests to the C++ object.
"""
+ if not hasattr(self, "_hb"):
+ raise RuntimeError("hier_block2: invalid state--did you forget to call gr.hier_block2.__init__ in a derived class?")
return getattr(self._hb, name)
def connect(self, *points):
diff --git a/gnuradio-core/src/python/gnuradio/gr/top_block.py b/gnuradio-core/src/python/gnuradio/gr/top_block.py
index b9c436a0a..71e401424 100644
--- a/gnuradio-core/src/python/gnuradio/gr/top_block.py
+++ b/gnuradio-core/src/python/gnuradio/gr/top_block.py
@@ -89,6 +89,8 @@ class top_block(object):
self._tb = top_block_swig(name)
def __getattr__(self, name):
+ if not hasattr(self, "_tb"):
+ raise RuntimeError("top_block: invalid state--did you forget to call gr.top_block.__init__ in a derived class?")
return getattr(self._tb, name)
def start(self):