discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] OOT sourcec block in python error


From: Kyeong Su Shin
Subject: Re: [Discuss-gnuradio] OOT sourcec block in python error
Date: Tue, 31 Jul 2018 00:55:15 +0000

Hello Ayaz,


If you are getting 'Template error' messages, you will have to check the XML file of your block (in grc directory). 


Also, 'input' is not a valid variable name in Python, as it is used for other purposes. You will have to re-name that variable to something else.


Finally, "out[0][:] = self.input" should become "out[:] = self.input" as you already selected output port and you are not outputting vectors.


Regards,

Kyeong Su Shin



보낸 사람: Ayaz Mahmud <address@hidden> 대신 Discuss-gnuradio <discuss-gnuradio-bounces+address@hidden>
보낸 날짜: 2018년 7월 31일 화요일 오전 2:22:35
받는 사람: address@hidden
제목: [Discuss-gnuradio] OOT sourcec block in python error
 

Hi,

 

I am trying to build a source block in python. Below is my code. After using the block I am getting a syntax error: self.Span_SourceBlock_0 = Template error: Span.SourceBlock($input)

 

My block should take input from user(int/float), and output the same. Though these are available blocks in GnuRadio but I am trying to learn on building it. Can you please check if my way of writing the code is correct?

 

import numpy

from gnuradio import gr

 

class SourceBlock(gr.sync_block):

    """

    docstring for block SourceBlock

    """

    def __init__(self, input):

        self.input = input

        gr.sync_block.__init__(self,

            name="SourceBlock",

            in_sig=None,

            out_sig=[numpy.float32])

 

 

    def work(self, input_items, output_items):

        out = output_items[0]

        out[0][:] = self.input

        return len(output_items[0])

 

Thanks,

Ayaz


reply via email to

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