Re: Python embedded block stops working after consume()

2021-10-28 Thread Verónica Toro Betancur
Yeah, I know it's strange and I shouldn't need to use any of those. But, the -2 in return is because that's the value of WORK_CALLED_PRODUCE which doesn't exist in Python, so that's why we put the -2 directly. And so this doesn't terminate flowgraph. At least that's what I understand. On Thu, Oct

Re: Python embedded block stops working after consume()

2021-10-28 Thread Jeff Long
You should not call produce() or consume() in a sync block, actually. The framework does those for you, using the return value from work(). If you return -2, you're manually terminating the flowgraph from this block? Glad it's working for you, in any case. On Thu, Oct 28, 2021 at 6:24 AM Verónica

Re: Python embedded block stops working after consume()

2021-10-28 Thread Verónica Toro Betancur
Nevermind now, I figured it out! It turns out that using produce() instead of consume() does the trick, but I couldn't say why. So, the last three lines should be output_items[0][:] = input_items[0] self.produce(0, len(output_items[0])) return -2 Although, in the followin

Re: Python embedded block stops working after consume()

2021-10-27 Thread Verónica Toro Betancur
I see but no, I'm not processing a finite number of samples. I'm generating a message periodically with a Message Strobe, then the message is encoded and modulated as a WiFi signal using the modules in: https://github.com/bastibl/gr-ieee802-11. Now, I'm trying to detect the signals myself and then

Re: Python embedded block stops working after consume()

2021-10-27 Thread Jeff Long
If you are feeding a flowgraph a finite number of samples, there is no guarantee the last samples will be processed before the flowgraph terminates. Could that be what you're seeing? Otherwise, post what you're doing and someone can try to help further. On Wed, Oct 27, 2021 at 3:00 PM Verónica Tor

Re: Python embedded block stops working after consume()

2021-10-27 Thread Verónica Toro Betancur
Hi Jeff, Thank you for your reply. I have tried returning len(output_items[0]) and using it in the consume function and it still doesn't work. Also, if I don't use consume() or consume_each(), it seems like the last part of the signal is dropped and I can't decode it correctly in the blocks that

Re: Python embedded block stops working after consume()

2021-10-27 Thread Jeff Long
The input vector may contain more items than the scheduler is expecting you to return. Use len(output_items[0]) to determine how much to consume and return. For reference, here is the autogenerated code for a new module: def work(self, input_items, output_items): in0 = input_items[0]

Python embedded block stops working after consume()

2021-10-27 Thread Verónica Toro Betancur
Hi, I've been trying to implement a sync python embedded block that processes all input_items. At the end of the work() function, I call output_items[0][:] = input_items[0] self.consume_each(len(input_items[0])) return len(input_items[0]) This works well the first time and all data is processed