Problem with Basic Block in Python


I have been writing a Python block and having realised I would need to
have a mismatch between input and output items, I tried to create a new
‘basic block’.

I haven’t even added any code yet, it is:

"import numpy
from gnuradio import gr

class insert_packets_bb(gr.basic_block):
docstring for block insert_packets_bb
def init(self, bits_per_symbol=1):

def forecast(self, noutput_items, ninput_items_required):
    #setup size of input_items[i] for work call
    for i in range(len(ninput_items_required)):
        ninput_items_required[i] = noutput_items

def general_work(self, input_items, output_items):
    output_items[0][:] = input_items[0]
    consume(0, len(input_items[0]))
    return len(output_items[0])"

And I get the error

"handler caught exception: operands could not be broadcast together with
shapes (512) (595)
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/gnuradio/gr/”,
line 55, in eval
try: self._callback()
File “/usr/local/lib/python2.7/dist-packages/gnuradio/gr/”,
line 144, in __gr_block_handle
) for i in self.__out_indexes],
“/usr/local/lib/python2.7/dist-packages/trl/”, line
46, in general_work
output_items[0][:n_processed] = input_items[0]
ValueError: operands could not be broadcast together with shapes (512)
(595) "

Can you help?

Many thanks.