[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Embedded Python Block Tutorial Param ID Error
From: |
Solomon Tan |
Subject: |
Re: Embedded Python Block Tutorial Param ID Error |
Date: |
Sat, 8 May 2021 19:35:30 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
Hi Sebastian,
Thanks for the reply. I could rerun the flowchart by deleting the epy python
files and the __pycache__ subdirectory, close and reopen GRC. It would allow me
to run it once more before the same Param ID error appeared. So i suppose it is
that commit that is responsible (but I dont know how to confirm it).
Whats interesting though is that I notice that the same patch was included in
maint3.9 but I did not encounter this problem at all with the code I compiled
from maint3.9. I only had this problem with the master branch as of my first
email today.
I would love to fix this bug but I just started using GRC so Im still unfamiliar
with the software. Would you like me to open an Issue on Github to make it
easier for the gr-dev team to solve the issue?
Cheers,
Sol
On 8/5/21 3:40 pm, Sebastian Koslowski wrote:
> Hi,
>
> that looks like a bug introduced by
> https://github.com/gnuradio/gnuradio/pull/4522
> <https://github.com/gnuradio/gnuradio/pull/4522>
> We forgot to special-case / adapt epy blocks...
>
> Sebastian
>
> (von unterwegs gesendet)
>
> On Sat, May 8, 2021, 06:23 Solomon Tan <solomonbstoner@yahoo.com.au
> <mailto:solomonbstoner@yahoo.com.au>> wrote:
>
> Dear all,
>
> I was following the GNURadio Embedded Python Block Tutorial. After adding
> a
> Python block, I got the following error.
>
> ```
>
> Param - Id(id):
>
> ID "epy_block_0" is blacklisted.
>
> ```
>
> The parameter ID of the Python block is marked in red. Why and how? The
> weirdest thing is that the Python block worked initially at first. I could
> run the
> flowgraph, but after stopping it, I couldnt rerun it again. I was given
> that
> Param
> ID error. My code was almost equivalent to the template, so it cant be my
> fault
> , right?
> ```
> """
> Embedded Python Blocks:
> """
> import numpy as np
> from gnuradio import gr
>
> class blk(gr.sync_block):
> """Embedded Python Block example - a simple multiply const"""
>
>
> def __init__(self, example_param=1.0): # only default arguments here
> """arguments to this function show up as parameters in GRC"""
> gr.sync_block.__init__(
> self,
> name='EPB Multiply by Const', # will show up in GRC
> in_sig=[np.float32],
> out_sig=[np.float32]
> )
> # if an attribute with the same name as a parameter is found,
> # a callback is registered (properties work, too).
> self.example_param = example_param
>
>
> def work(self, input_items, output_items):
> """example: multiply with constant"""
> output_items[0][:] = input_items[0] *2 * self.example_param
> return len(output_items[0])
> ```
>
> I could not find any other mail in the archive about this parameter ID
> error.
>
> Thank you.
> Cheers,
> Sol
>