discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: File Meta Sink question


From: Hassel, George
Subject: Re: File Meta Sink question
Date: Wed, 15 Mar 2023 17:26:37 -0400

I was able to get a little farther with using import pmt in the Import block.   I am now having some new difficulty with the Extra Dict field in the File Meta Sink block.    I'd like to add a few definitions to the Extra Dictionary.

If I use:
pmt.dict_add(pmt.make_dict(),pmt.intern('FFT_size'),pmt.from_long(FFT_size))
to add in the FFT_size, that will run without error.   However, I'm not sure how to add another entry.

If I try adding another entry,
pmt.dict_add(pmt.make_dict(),pmt.intern('FFT_size'),pmt.from_long(FFT_size)), pmt.dict_add(pmt.make_dict(),pmt.intern('freq'),pmt.from_long(freq))

I get an error about incompatible constructor arguments:
in __init__
    self.blocks_file_meta_sink_0 = blocks.file_meta_sink(gr.sizeof_float*FFT_size, 'output.dat', samp_rate, 1, blocks.GR_FILE_FLOAT, False, 1000000, pmt.dict_add(pmt.make_dict(),pmt.intern('FFT_size'),pmt.from_long(FFT_size)),pmt.dict_add(pmt.make_dict(),pmt.intern('freq'),pmt.from_long(freq)), False)
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. gnuradio.blocks.blocks_python.file_meta_sink(itemsize: int, filename: str, samp_rate: float = 1, relative_rate: float = 1, type: gnuradio.blocks.blocks_python.gr_file_types = <gr_file_types.GR_FILE_FLOAT: 5>, complex: bool = True, max_segment_size: int = 1000000, extra_dict: pmt.pmt_python.pmt_base = (), detached_header: bool = False)

Invoked with: 4096, 'output.dat', 10000000, 1, <gr_file_types.GR_FILE_FLOAT: 5>, False, 1000000, ((FFT_size . 1024)), ((freq . 105700000)), False


If I try the entry this way:
pmt.dict_add(pmt.make_dict(),pmt.intern('FFT_size','freq'),pmt.from_long(FFT_size,freq))

I get an error in the block:
 Param - Extra Dict.(extra_dict):
Value "pmt.dict_add(pmt.make_dict(),pmt.intern('FFT_size','freq'),pmt.from_long(FFT_size,freq))" cannot be evaluated:
intern(): incompatible function arguments. The following argument types are supported:
   1. (s: str) -> pmt.pmt_python.pmt_base

I'm not sure how to add multiple entries to the dictionary, or if it's possible to do so.    Thanks for any assistance!
Invoked with: 'FFT_size', 'freq'


On Sun, Mar 12, 2023 at 5:54 PM Hassel, George <ghassel@siena.edu> wrote:
I'm still having some trouble with this issue.    If I try to add a File Meta Sink block, I get an error involving pmt.make_dict() that indicates that pmt is not defined:
image.png
image.png


If I try to add an import block, I can't change the case of "Import", and get an error message as shown
image.png


image.png

I'm having trouble finding any documentation to help with this.

Thanks!
-George


On Thu, Mar 9, 2023 at 11:06 AM Hassel, George <ghassel@siena.edu> wrote:
Hello, 

I'm having some difficulty with saving metadata.   I'm trying to use File Meta Sink as a block in gnuradio companion, and I get an error message in the Extra Dict. filed that "Value "pmt.make_dict()" cannot be evaluated: name 'pmt' is not defined.    I try to add in an Import block that says Import pmt, and get an error that says "Param - Import(imports): Bad import syntax: "pmt".  

If I instead just use a python script with import pmt, I still get errors involving the File Meta Sink blocks. 

I tried to make sure that pmt was installed with pip3 install pmt, but that causes an error with finding the paths for gnuradio.   I resolved that by following the instructions at https://wiki.gnuradio.org/index.php/ModuleNotFoundError, but again come back to the same errors involving pmt. 

My Ubuntu version is 22.10
My gnuradio version is 3.10.3.0
My python3 version is 3.10.7 

Thanks for any assistance you can provide!

-George Hassel

reply via email to

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