On Wed, Feb 20, 2013 at 1:39 PM, Brooke Hayden <[email protected]> wrote:

> I am transmitting a signal from my USRP N210, but I would like to also see
> that signal on screen in a gui. I'm currently getting an error that I don't
> understand. I have a simple class, tx_test(gr.heir_block2), that simply
> transmits a sine wave.
>
> The second class, tx_sink(stdgui2.std_to_block), has the following things:
> def __init__(self, frame, panel, vbox, argv):
>         stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
>
>         parser = OptionParser(option_class=eng_option)
>         parser.add_option .....adds some options....
>         (options, args) = parser.parse_args ()
>         self.u = uhd.usrp_sink(device_addr=options.args,
>
> stream_args=uhd.stream_args('fc32'))
> It goes on to set sample rates and such. Lastly I have:
>          sig0 = tx_test(options.samp_rate)
>          self.connect(sig0, self.u)
>
>          gui = fftsink2.fft_sink_c(panel, title="Tx FFT Plot",
>                                              fft_size=1024,
> sample_rate=self.usrp_rate)
>         self.connect (sig0, gui)
>         vbox.Add (gui.win, 1, wx.EXPAND)
>
> def main ():
>     app = stdgui2.stdapp(tx_sink, "Transmitted Signal", nstatus=1)
>     app.MainLoop ()
>
> if __name__ == '__main__':
>     main ()
>
> I get the following error:
> File "tx_test_gui.py", line 47, in tx_sink
>     self.u = uhd.usrp_sink(device_addr=options.args,
> stream_args=uhd.stream_args('fc32'))
> NameError: name 'self' is not defined
>

My first guess to this is incorrect whitespace. Make sure your "def
__init__" function is properly set under the class name and there's no odd
spacing anywhere else (or that you have both tabs and spaces that are
confusing the parser).

Tom
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to