Nevermind.    Problem was in my code creating the np.array over on the send
side.  Sorry to waste the bandwidth.

-- Tom, N5EG





On Mon, Jan 1, 2018 at 1:23 PM, Tom McDermott <tom.n...@gmail.com> wrote:

>
> Hello, Happy New Year !
>
> I am trying to use message passing in gnuradio maint branch, 3.7.11.1
> (python 2.7 based)
>
> When just bringing up a command line window, starting python 2.7,
> importing gnuradio, numpy and pmt,
> the behavior I get (which agrees with the documentation):
>
> n = np.array([1,2,3,4,5], dtype=uint8)
> p = pmt.to_pmt(n)
> r = pmt.to_python(p)
>
> printing the types of a, p, and r yield the expected...
>
> type(n) -->  <type 'numpy.ndarray'>
> type(p) --> <class 'pmt.pmt_swig.swig_int_ptr'>
> type(r) -->  <type 'numpy.ndarray'>
>
>
>
> However when in gnuradio
> create and pass the pmt via the message port,
> I get a string type after converting to python:
>
>
>     def handle_rxmsg(self, msg):
>         dat = pmt.to_python(msg)  # dat is an np.array[9] of type np.uint8
>         print "Type of msg: ", type(msg)
>         print "Type of dat: ", type(dat)
>
>
> This prints on the gnuradio console:
>
> Type of msg:  <class 'pmt.pmt_swig.swig_int_ptr'>
> Type of dat:  <type 'str'>
>
>
> Does anyone know how do I get back a numpy array from pmt while
> running under gnuradio?
>
> Why does this work in a command line console, but not in gnuradio?
>
>
> -- Tom, N5EG
>
>
>
>
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to