Howto module please help

Hello, I posted this a week ago and received no response. Any comments
or suggestions would be greatly appreciate.

I recently got python programs to successfully import the howto
module, but I cannot use the functions:

Python code:
#!/usr/bin/env python

from gnuradio import gr
import howto

class my_top_block(gr.top_block):

def init(self):
gr.top_block.init(self)

src_nums = (4, 5, 6)
src = gr.vector_source_f (src_nums)
sqr = howto.square_ff ()
dst = gr.vector_sink_f ()
self.connect (src, sqr)
self.connect (sqr, dst)
print "src:
", src
print "sqr: ", sqr
print "dst.data: ", dst.data()

if name == ‘main’:
my_top_block().run()

Output:
src: <gr_block vector_source_f (1)>
sqr: <gr_block square_ff (2)>
dst.data: ()
Segmentation fault

Thanks,
Mike

On Mon, Nov 01, 2010 at 03:29:25PM -0700, Michael Civ wrote:

Hello, I posted this a week ago and received no response. Any comments or
suggestions would be greatly appreciate.

I recently got python programs to successfully import the howto
module, but I cannot use the functions:

Michael,

I just built gnuradio and howto from the git master (Fedora 13 on
x86-64).
It doesn’t SEGFAULT for me leading me to think that you have a hosed-
up GNU Radio installation on your system. Is there any chance that
you’ve got more than one installation? Perhaps one from a .deb or
.rpm and one from source? If so, uninstall the packaged one.

Also, what you really want is something like the code below.
Otherwise the dst.data() is always empty, since the graph hasn’t run
when you first print it out.

Eric

$ cd gnuradio
$ ./bootstrap && ./configure --disable-docs
$ (make -j12 && make check && make install) 2>&1 | tee make.log
$ cd gr-howto-write-a-block/
$ ./bootstrap
$ ./configure
$ make && make check && make install

#!/usr/bin/env python

from gnuradio import gr
import howto

class my_top_block(gr.top_block):
def init(self):
gr.top_block.init(self)

src_nums = (4, 5, 6)
src = gr.vector_source_f (src_nums)
sqr = howto.square_ff ()
dst = gr.vector_sink_f ()
self.dst = dst
self.connect (src, sqr)
self.connect (sqr, dst)
print "src: ", src
print "sqr: ", sqr
print "dst.data: ", dst.data()

if name == ‘main’:
tb = my_top_block()
tb.run()
print "dst.data: ", tb.dst.data()

$ /tmp/test.py
src: <gr_block vector_source_f (1)>
sqr: <gr_block square_ff (2)>
dst.data: ()
dst.data: (16.0, 25.0, 36.0)

Eric,

Thanks for getting back to me. I rewrote the code as suggested (thanks
for the tip) and still get the SEGFAULT.

I’m not sure how to check if I have multiple installations. I have
folders titled “gnuradio” in the following locations:

/home/mike
/home/mike/gnuradio/gnuradio-core/src/python
/home/mike/gnuradio/gruel/src/scheme
/etc
/usr/include
/usr/lib/python2.6/dist-packages
/usr/share

/usr/share/doc
/usr/local/etc
/usr/local/include
/usr/local/lib/python2.6/dist-packages
/usr/local/share
/usr/local/libexec

and the gnuradio-core folder is only located in

/home/mike/gnuradio

Does that make it seem like I have multiple installations (and if so,
which ones should i remove)? How else could I find out?

Thanks for the help,
Mike

— On Mon, 11/1/10, Eric B. [email protected] wrote:

From: Eric B. [email protected]
Subject: Re: [Discuss-gnuradio] howto module … please help
To: “Michael Civ” [email protected]
Cc: [email protected]
Date: Monday, November 1, 2010, 5:14 PM

On Mon, Nov 01, 2010 at 03:29:25PM -0700, Michael Civ wrote:

Hello, I posted this a week ago and received no response. Any comments or
suggestions would be greatly appreciate.

I recently got python programs to successfully import the howto
module, but I cannot use the functions:

Michael,

I just built gnuradio and howto from the git master (Fedora 13 on
x86-64).
It doesn’t SEGFAULT for me leading me to think that you have a hosed-
up GNU Radio installation on your system. Is there any chance that
you’ve got more than one installation? Perhaps one from a .deb or
.rpm and one from source? If so, uninstall the packaged one.

Also, what you really want is something like the code below.
Otherwise the dst.data() is always empty, since the graph hasn’t run
when you first print it out.

Eric

$ cd gnuradio
$ ./bootstrap && ./configure --disable-docs
$ (make -j12 && make check && make install) 2>&1 | tee make.log
$ cd gr-howto-write-a-block/
$ ./bootstrap
$ ./configure
$ make && make check && make install

#!/usr/bin/env python

from gnuradio import gr
import howto

class my_top_block(gr.top_block):
def init(self):
gr.top_block.init(self)

src_nums = (4, 5, 6)
src = gr.vector_source_f (src_nums)
sqr = howto.square_ff ()
dst = gr.vector_sink_f ()
self.dst = dst
self.connect (src, sqr)
self.connect (sqr, dst)
print "src: ", src
print "sqr: ", sqr
print "dst.data: ", dst.data()

if name == ‘main’:
tb = my_top_block()
tb.run()
print "dst.data: ", tb.dst.data()

$ /tmp/test.py
src: <gr_block vector_source_f (1)>
sqr: <gr_block square_ff (2)>
dst.data: ()
dst.data: (16.0, 25.0, 36.0)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs