Creating a gr_sync_block subclass in python?

Hi,

I would like to convert symbols (1 float) into two bytes. I thought I
want to
use a gr_sync_block for that (1:1 mapping). Now I would like to do this
in
python. After looking around, trying things and reading an old thread
from
october 2006 I come to the conclusion that it is not possible to create
a
gr_sync_block and have ‘‘work’’ called in python?

The reason to use python would be to avoid having the user compile stuff
and being faster in prototyping a solution. Is there any way to do some
processing in python?

kind regards
holger

On 01/08/2011 01:10 PM, Holger Freyther wrote:

Hi,

I would like to convert symbols (1 float) into two bytes. I thought I want to
use a gr_sync_block for that (1:1 mapping). Now I would like to do this in
python. After looking around, trying things and reading an old thread from
october 2006 I come to the conclusion that it is not possible to create a
gr_sync_block and have ‘‘work’’ called in python?

You cant make functions in python and pass them into C++. I think the
swig docs say something about this. Basically, the python functions are
just objects, they are not functions to be called when you get into the
c++ level. Maybe it can be done, but its outside the scope of what swig
covers, or at least its not simple or obvious.

The reason to use python would be to avoid having the user compile stuff
and being faster in prototyping a solution. Is there any way to do some
processing in python?

Yes, make a generic hier block class that has message queues in and out,
and a thread to read data, call a work function, write the data. Now you
can override this block with your own work function and io signature and
plug it into any generic python flowgraph.

-josh