Eric, I attempt to declare the source and the sink to both be the same type:
if options.input_shorts: self._u = usrp2.sink_16sc(options.interface, options.mac_addr) #the last True is to restart the file when it is done self._src = gr.file_source(gr.sizeof_short,filename,True) else: self._u = usrp2.sink_32fc(options.interface, options.mac_addr) #the last True is to restart the file when it is done self._src = gr.file_source(gr.sizeof_gr_complex, filename, True) .... self.connect(self._src, self._u); Is this not correct? Thanks, Ilya -----Original Message----- From: Eric Blossom [mailto:e...@comsec.com] Sent: Wednesday, September 16, 2009 5:24 PM To: Chukhman, Ilya A. Cc: discuss-gnuradio@gnu.org Subject: Re: [Discuss-gnuradio] Beginner Question: python script error when doing connect() On Wed, Sep 16, 2009 at 03:09:54PM -0400, Chukhman, Ilya A. wrote: > Hello, > > I am trying to create a python equivalent of tx_samples.cc -- to transmit > samples captured with usrp2_rx_cfile.py. When running my program, I receive > the following error: > > Traceback (most recent call last): > File "./usrp2_tx_cfile.py", line 151, in <module> > tb = tx_cfile_block(options, filename) > File "./usrp2_tx_cfile.py", line 80, in __init__ > self.connect(self._src, self._u); > File "/usr/lib/python2.6/dist-packages/gnuradio/gr/top_block.py", line 124, > in connect > self._connect(points[i-1], points[i]) > File "/usr/lib/python2.6/dist-packages/gnuradio/gr/top_block.py", line 130, > in _connect > dst_block.basic_block(), dst_port) > File > "/usr/lib/python2.6/dist-packages/gnuradio/gr/gnuradio_swig_py_runtime.py", > line 1443, in connect > return _gnuradio_swig_py_runtime.gr_top_block_sptr_connect(*args) > ValueError: itemsize mismatch: file_source(2):0 using 2, usrp2_sink_16sc(1):0 > using 4 > > From the error, it appears that the connect() call is failing, but I am not > sure why. > > This is what my usrp2_tx_cfile.py looks like. > > Thank you for your help. > Ilya You're sending 2-byte wide data into a input that expects 4-byte wide data. Eric
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio