[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] problems with python blocks [attn: jblum]

From: Paul Miller
Subject: [Discuss-gnuradio] problems with python blocks [attn: jblum]
Date: Sun, 4 Dec 2011 22:14:30 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

I have built a really simple block for testing purposes…

When I run it, I get segmentation faults and source diving has
not revealed the problem to me — there's a lot of code there, too
much for me it seems.

Am I doing something so horribly wrong?

The build I'm using from jbuml's git:

 * jblum d393bef gruel: put common swig stuff in gruel_common.

from gnuradio import gr
import math, numpy

class gr_norm(gr.basic_block):
    def __init__(self):
        gr.basic_block.__init__(self, name="normalizer", 
in_sig=[numpy.complex64], out_sig=[numpy.complex64])

    def general_work(self, input_items, output_items):
        in0 = input_items[0]
        out = output_items[0]

        out[0] = in0[0]

        self.consume(0, 1)

        return 1



from gnuradio import gr, gr_unittest
import numpy

class qa_norm(gr_unittest.TestCase):

    def setUp(self):
        self.tb = gr.top_block()

    def tearDown(self):
        self.tb = None

    def test_001_gr_norm(self):
        src_data = [ -10, 10, -10j, 10j ]
        expected_result = [ -1, 1, -1j, 1j ]
        src = gr.vector_source_c(src_data)
        nor = gr_norm()
        dst = gr.vector_sink_c()
        self.tb.connect(src, nor)
        self.tb.connect(nor, dst)
        result_data = dst.data()
        self.assertFloatTuplesAlmostEqual(expected_result, result_data, 6)
if __name__ == '__main__':

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffedaa6700 (LWP 18113)]
0x00007ffff7af908c in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#0  0x00007ffff7af908c in PyEval_EvalFrameEx () from 
#1  0x00007ffff7aff8ef in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#2  0x00007ffff7a8c15c in function_call () from /usr/lib/libpython2.7.so.1.0
#3  0x00007ffff7a67683 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#4  0x00007ffff7a762bf in instancemethod_call () from 
#5  0x00007ffff7a67683 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#6  0x00007ffff7a67d5d in PyObject_CallMethodObjArgs () from 
#7  0x00007ffff46ca774 in SwigDirector_gr_block_gw_handler_safe::call_handle 
#8  0x00007ffff66795f5 in gr_block_gateway_impl::start (this=0x1b7df30) at 
#9  0x00007ffff660eb37 in gr_block_executor::gr_block_executor 
(this=0x7fffedaa5d70, block=<optimized out>)
#10 0x00007ffff662ea44 in gr_tpb_thread_body::gr_tpb_thread_body 
(this=0x7fffedaa5d70, block=...)
#11 0x00007ffff6629834 in operator() (this=0x1b773a0) at 
#12 operator() (this=0x1b773a0) at 
 void>::invoke (function_obj_ptr=...)
    at /usr/include/boost/function/function_template.hpp:153
#14 0x00007ffff5e282fe in operator() (this=<optimized out>) at 
#15 boost::detail::thread_data<boost::function0<void> >::run (this=<optimized 
out>) at /usr/include/boost/thread/detail/thread.hpp:61
#16 0x00007ffff57c5699 in ?? () from /usr/lib/libboost_thread.so.1.48.0
#17 0x00007ffff7808df0 in start_thread () from /lib/libpthread.so.0
#18 0x00007ffff754e39d in clone () from /lib/libc.so.6
#19 0x0000000000000000 in ?? ()

If riding in an airplane is flying, then riding in a boat is swimming.
116 jumps, 48.6 minutes of freefall, 92.9 freefall miles.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]