discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: self.set_history error for python custom block


From: Marcus Müller
Subject: Re: self.set_history error for python custom block
Date: Tue, 26 Sep 2023 00:04:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

Yep, most methods of classes are like that; you need to initialize the class first, then can work on its state :) That's why other programming languages than Python don't even give you that much freedom about when to call the superclass constructor.

Anyway, I'm very glad you were able to fix that! Happy developing!

Cheers,
Marcus

On 25.09.23 23:01, Ivan Iudice wrote:
I found out to make it work!
The problem was that set_history needs to be called after the constructor of 
the super class. Probably it needs to know first the input signature. You will 
be able to confirm me that.
Thanks for help!

Ivan

Il giorno 25 set 2023, alle ore 16:12, Marcus Müller <mmueller@gnuradio.org> ha 
scritto:

Python incompatibility can safely be ruled out; you wouldn't get far enough. 
Please share a minimal example of a block that triggers the behaviour.

Best,
Marcus

On 25.09.23 15:49, Ivan Iudice wrote:
Nobody knows where could be the problem?
I thought an incompatibility between gnuradio and python versions.
Regards.
Ivan
Il giorno 21 set 2023, alle ore 18:13, Ivan Iudice <krono86@tiscali.it> ha 
scritto:

Dear Jeff,
thank you for answer.
My code does exactly the same things.
Regards.

Ivan

Il giorno 21 set 2023, alle ore 17:55, Jeff Long <willcode4@gmail.com> ha 
scritto:


Here is an example (from the QA code) of using history from a Python block.

https://github.com/gnuradio/gnuradio/blob/5953d3c96b42086c5f8c5f97b6fd7e57717f9aa5/gr-blocks/python/blocks/qa_block_gateway.py#L60
 
<https://github.com/gnuradio/gnuradio/blob/5953d3c96b42086c5f8c5f97b6fd7e57717f9aa5/gr-blocks/python/blocks/qa_block_gateway.py#L60>

See if your code appears to be doing the same thing.

On Thu, Sep 21, 2023 at 11:03 AM <krono86@tiscali.it 
<mailto:krono86@tiscali.it>> wrote:

    __
    Hello List!
    I'm trying to implement a sync block into a OOT module that use previous 
samples of
    the input streams.
    So, I'm using the method set_history in the constructor.
    The problem is that when I use self.set_history(N) I obtain the following 
errors:

    Generating: 
'/home/userr/workspace/gnuradio-oot/gr-customModule/examples/untitled.py'

    Executing: /usr/bin/python3 -u
    /home/user/workspace/gnuradio-oot/gr-customModule/examples/untitled.py

    QSocketNotifier: Can only be used with threads started with QThread
    Traceback (most recent call last):
      File 
"/home/user/workspace/gnuradio-oot/gr-customModule/examples/untitled.py",
    line 291, in <module>
        main()
      File 
"/home/user/workspace/gnuradio-oot/gr-customModule/examples/untitled.py",
    line 269, in main
        tb = top_block_cls()
             ^^^^^^^^^^^^^^^
      File 
"/home/user/workspace/gnuradio-oot/gr-customModule/examples/untitled.py",
    line 179, in __init__
        self.customModule_testBlock_0_0 = customModule.testBlock(1, max_lag, 
lags,
    alpha, win_len, 1, False)
                                             
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File
    
"/usr/local/lib/python3.11/dist-packages/gnuradio/customModule/testBlock.py", 
line
    33, in __init__
        self.set_history(self.max_pos_lag-self.min_neg_lag+1)
        ^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/gnuradio/gr/gateway.py", line 129, in
    __getattr__
        if not hasattr(self, "gateway"):
               ^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/gnuradio/gr/gateway.py", line 129, in
    __getattr__
        if not hasattr(self, "gateway"):
               ^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/gnuradio/gr/gateway.py", line 129, in
    __getattr__
        if not hasattr(self, "gateway"):
               ^^^^^^^^^^^^^^^^^^^^^^^^
      [Previous line repeated 984 more times]
    RecursionError: maximum recursion depth exceeded

    >>> Done (return code 1)

    I'm using GNU Radio 3.10.5.1 (Python 3.11.2) on Debian 12.
    What is going on?
    Thanks in advance!
    Ivan






reply via email to

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