Hi,
I have written a Python block that I want to connect to the WXGUI Number
Sink using a float. I set the output to a float, and it appears
correctly in GRC, and I can connect my block to the WX GUI Number Sink
block with no error, but when I run it, I get:
Traceback (most recent call last):
File
“/home/gnuradio/gnuradio_build/gnuradio/gr-digital/examples/ofdm_post_magnus/rx_ofdm.py”,
line 329, in
tb = rx_ofdm()
File
“/home/gnuradio/gnuradio_build/gnuradio/gr-digital/examples/ofdm_post_magnus/rx_ofdm.py”,
line 183, in init
self.connect((self.trl_ber_i_0, 0), (self.wxgui_numbersink2, 0))
File
“/usr/local/lib/python2.7/dist-packages/gnuradio/gr/top_block.py”, line
130, in connect
self._connect(points[i-1], points[i])
File
“/usr/local/lib/python2.7/dist-packages/gnuradio/gr/top_block.py”, line
142, in _connect
dst_block.to_basic_block(), dst_port)
File
“/usr/local/lib/python2.7/dist-packages/gnuradio/gr/runtime_swig.py”,
line 4292, in primitive_connect
return _runtime_swig.top_block_sptr_primitive_connect(self, *args)
ValueError: itemsize mismatch: ber_i1:0 using 8, number_sink0:0 using 4
My XML file is:
<?xml version="1.0"?> ber_i trl_ber_i trl import trl trl.ber_i($filename, $window_length) File filename file_save Window Length window_length 0 int in byte ref byte out floatand the Python code is:
import numpy
import pmt
from gnuradio import gr
#class ber_i(gr.sync_block):
class ber_i(gr.sync_block, gr.tagged_stream_block):
“”"
docstring for block ber_i
“”"
def init(self, filename=’’, window_length=0):
gr.sync_block.init(self,
name=“ber_i”,
in_sig=[numpy.byte,numpy.byte],
out_sig=[numpy.float])
global d_filename
d_filename = filename
global d_window_length
d_window_length = window_length
global rx_string
global ref_string
global total_len
rx_string = ‘’
ref_string = ‘’
total_len = 0
def work(self, input_items, output_items):
in0 = input_items[0]
out = output_items[0]
in_items = input_items
'''
out[:] = float(55)
return len(input_items[0])