- Try the latest gr_modtool from github - What you're doing seems weird--why are you connecting message blocks? These are meant as a hackish solution to access samples from outside the flow graph. Perhaps you want the new PDU to stream blocks?
MB On Mon, Jan 28, 2013 at 04:42:04PM +0100, Nemanja Savic wrote: > Since I don't know why gr_modtool doesn't work for me, I took the older > working > version and made very simple hier block in order to understand messages flow > in > gnuradio. > > The block code is following: > > > from gnuradio import gr > > class msg_proba(gr.hier_block2): > def __init__(self, ): > gr.hier_block2.__init__(self, "msg_proba", > gr.io_signature(1, 1, gr.sizeof_char), # Input signature > gr.io_signature(1, 1, gr.sizeof_char)) # Output signature > > gr_message_sink_0_msgq_out = gr_message_source_0_msgq_in = > gr.msg_queue(4) > > self.gr_message_source_0 = gr.message_source(gr.sizeof_char*1, > gr_message_source_0_msgq_in) > self.gr_message_sink_0 = gr.message_sink(gr.sizeof_char*1, > gr_message_sink_0_msgq_out, False) > > self.connect(self, self.gr_message_sink_0) > self.connect(self.gr_message_source_0, self) > > > > and the test code is following: > > > > from gnuradio import gr, gr_unittest > import test > import msg_proba > > class qa_msg_proba (gr_unittest.TestCase): > > def setUp (self): > self.tb = gr.top_block () > > def tearDown (self): > self.tb = None > > def test_001_msg_proba (self): > > self.src_data = () > self.expected_result = () > > for i in range(51): > self.src_data = self.src_data + (1,) > self.expected_result = self.expected_result+(1,) > > self.src = gr.vector_source_b(self.src_data, False, 1) > self.dst = gr.vector_sink_b () > > self.msg_pr = msg_proba.msg_proba() > > self.tb.connect(self.src, self.msg_pr, self.dst) > > self.tb.run () > # check data > result_data = dst.data () > self.assertEqual (expected_result, result_data) > > if __name__ == '__main__': > gr_unittest.main () > > > When I run test, it doesn't finish. No errors, just stays active without > giving > any results. > > Can somebody provide some explanation? > > > > > On Mon, Jan 28, 2013 at 10:28 AM, Nemanja Savic <vlasi...@gmail.com> wrote: > > > I installed new version of gr_modtool script and it won't work. The error > is following: > > [savi_ne@ts-070046nl gr-test]$ gr_modtool.py add -N rx_tx_message -t hier > -l python > Using Python < 2.7 possibly buggy. Ahem. Please send all complaints to > /dev > /null. > Operating in directory . > GNU Radio module name identified: test > Language: Python > Block/code identifier: rx_tx_message > Enter valid argument list, including default arguments: > Add Python QA code? [Y/n] n > Traversing python... > Adding file 'rx_tx_message.py'... > > > Traceback (most recent call last): > > File "/usr/local/bin/gr_modtool.py", line 3369, in <module> > main() > File "/usr/local/bin/gr_modtool.py", line 3362, in main > modtool.run() > File "/usr/local/bin/gr_modtool.py", line 1339, in run > self._run_python() > File "/usr/local/bin/gr_modtool.py", line 1479, in _run_python > self._write_tpl('block_python', 'python', fname_py) > File "/usr/local/bin/gr_modtool.py", line 1324, in _write_tpl > open(os.path.join(path, fname), 'w').write(get_template(tpl, > **self._info)) > File "/usr/local/bin/gr_modtool.py", line 870, in get_template > return str(GRMTemplate(Templates[tpl_id], searchList=kwargs)) > File "/usr/local/bin/gr_modtool.py", line 865, in __init__ > Cheetah.Template.Template.__init__(self, src, searchList=searchList) > File "/usr/lib64/python2.6/site-packages/Cheetah/Template.py", line > 1257, > in __init__ > self._compile(source, file, compilerSettings=compilerSettings) > File "/usr/lib64/python2.6/site-packages/Cheetah/Template.py", line > 1551, > in _compile > keepRefToGeneratedCode=True) > File "/usr/lib64/python2.6/site-packages/Cheetah/Template.py", line 795, > in compile > raise parseError > Cheetah.Parser.ParseError: > > Error in the Python code which Cheetah generated for this template: > > =========================================================================== > ===== > > expected an indented block (DynamicallyCompiledCheetahTemplate.py, line > 122) > > Line|Python Code > ----|------------------------------------------------------------- > 120 | deciminterp = '' > 121 | else: # generated from line 42, col 1 > 122 | write(u'''from gnuradio import gr > ^ > 123 |class ''') > 124 | _v = VFFSL(SL,"blockname",True) # u'${blockname}' on line 46, > col 7 > 125 | if _v is not None: write(_filter(_v, > rawExpr=u'${blockname}')) > # from line 46, col 7. > > > =========================================================================== > ===== > > Here is the corresponding Cheetah code. > ** I had to guess the line & column numbers, so they are probably > incorrect: > > Line 42, column 1 > > Line|Cheetah Code > ----|------------------------------------------------------------- > 39 |#else if $blocktype == 'decimator' > 40 |#set $deciminterp = ', <+decimation+>' > 41 |#set $deciminterp = '' > 42 |#else > ^ > 43 |#end if > 44 |from gnuradio import gr > 45 | > > > Any suggestions how to ovecome this except using older version which > worked > perfectly? > > > > On Fri, Jan 25, 2013 at 9:22 PM, Nemanja Savic <vlasi...@gmail.com> wrote: > > > Thank you Martin, I will try that on Monday. > > I suppose that I have older version of gr_modtool, cause there is no > option -l for selecting language. > > My weekend would be maybe perfect If you or anybody else can explain > to > me why my code won't work, cause I have more or less copied block > structure from grextras. > > > Nice weekend > > Nemanja > > > > On Fri, Jan 25, 2013 at 5:18 PM, Martin Braun (CEL) < > martin.br...@kit.edu> wrote: > > For a hier block in Python, do > > $ gr_modtool.py add -t hier -l python > > You need 3.6.3 to do that. > > Also, you'll need a new version of modtool (it usually lags a bit > behind > changes in GNU Radio). > > MB > > > > On Fri, Jan 25, 2013 at 05:05:56PM +0100, Nemanja Savic wrote: > > Hi all, > > > > > > today i was trying to make hierarchical signal processing block > in Python. I > > started with gr_modtool script, and configured it for hierpython > block type. > > > > > > My idea was to design block similar to packet framer, so inside > of the new > > block, I connected binary slicer and Framer sink. I have also > declared message > > queue. > > > > > > Outside of main block, I designed another block which should > collect messages > > sent by framer from the main block. > > > > > > When I wanted to run this block, I got following error: > > > > > > > > Traceback (most recent call last): > > File "/home/savi_ne/work/gnuradio/GRC/top_block.py", line 439, > in <module> > > tb = top_block() > > File "/home/savi_ne/work/gnuradio/GRC/top_block.py", line 183, > in __init__ > > self.test_packet_proba_0 = test.packet_proba() > > AttributeError: 'module' object has no attribute 'packet_proba' > > > > > > > > Next I found that maybe I have to put following line in > __init__.py file: > > > > from packet_proba import * > > > > > > After that I got similar error: > > > > Traceback (most recent call last): > > File "/home/savi_ne/work/gnuradio/GRC/top_block.py", line 18, > in <module> > > import test > > File "/usr/local/lib64/python2.6/site-packages/test/ > __init__.py", line 49, in > > <module> > > from packet_proba import * > > File "/usr/local/lib64/python2.6/site-packages/test/ > packet_proba.py", line > > 51, in <module> > > class proba(gr.basic_block): > > AttributeError: 'module' object has no attribute 'basic_block' > > > > > > I have also tried with gr.block instead of gr.basic_block, but > with identical > > results. > > > > > > Can anybody tell what's missing? > > > > > > Thanks > > > > > > -- > > Nemanja Savić > > > > > > _______________________________________________ > > Discuss-gnuradio mailing list > > Discuss-gnuradio@gnu.org > > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > > -- > Karlsruhe Institute of Technology (KIT) > Communications Engineering Lab (CEL) > > Dipl.-Ing. Martin Braun > Research Associate > > Kaiserstraße 12 > Building 05.01 > 76131 Karlsruhe > > Phone: +49 721 608-43790 > Fax: +49 721 608-46071 > www.cel.kit.edu > > KIT -- University of the State of Baden-Württemberg and > National Laboratory of the Helmholtz Association > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > > > > > -- > > Nemanja Savić > > > > > -- > Nemanja Savić > > > > > -- > Nemanja Savić > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio -- Karlsruhe Institute of Technology (KIT) Communications Engineering Lab (CEL) Dipl.-Ing. Martin Braun Research Associate Kaiserstraße 12 Building 05.01 76131 Karlsruhe Phone: +49 721 608-43790 Fax: +49 721 608-46071 www.cel.kit.edu KIT -- University of the State of Baden-Württemberg and National Laboratory of the Helmholtz Association
pgpT5nImdNCmw.pgp
Description: PGP signature
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio