Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'attribute': 0.07; 'error:': 0.07; 'parser': 0.07; 'variables': 0.07; '__name__': 0.09; 'args)': 0.09; 'optparse': 0.09; 'skip:o 50': 0.09; 'subject:script': 0.09; 'subject:while': 0.09; 'true)': 0.09; 'python': 0.11; 'def': 0.12; '###': 0.16; "'__main__':": 0.16; '0))': 0.16; '0),': 0.16; 'blocks': 0.16; 'skip:g 50': 0.16; 'skip:g 70': 0.16; 'waterfall': 0.16; 'subject:python': 0.16; 'skip:= 10': 0.16; 'student': 0.16; 'import': 0.22; 'skip:_ 20': 0.27; 'skip:& 60': 0.30; 'skip:g 30': 0.30; 'message- id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'code': 0.31; "skip:' 10": 0.31; 'anyone': 0.31; 'class': 0.32; 'skip:c 30': 0.32; 'run': 0.32; 'skip:# 10': 0.33; 'skip:_ 10': 0.34; 'skip:d 20': 0.34; 'knows': 0.35; 'skip:s 30': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'skip:" 50': 0.36; 'skip:s 60': 0.36; 'connections': 0.38; 'window': 0.38; 'skip:[ 10': 0.38; 'to:addr :python-list': 0.38; '12,': 0.39; 'to:addr:python.org': 0.39; 'unable': 0.39; 'skip:p 20': 0.39; 'skip:u 10': 0.60; 'radio': 0.60; 'skip:t 30': 0.61; 'skip:n 10': 0.64; 'skip:w 30': 0.69; 'gain': 0.79; 'ali': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=VCjdXKKKcH0wYXPrY/JQerfqSpAyL8NhSZ7wc52c3FY=; b=tjLxi0Lj3UASgHR1jaY3gHIEeLPXSEJwzQxwy2zHkVbInJ6JqyNOHcI+lU63jo1X01 9UKEigCYsKi9j4GezmJMnpDWdgtSULoqnCIy260ISMoa+ShDk09bsBHDsGGnLtxYZyAH TIqwLxsaUGUnztbCTEVqNigHRQMPzfM5NDuO2X7H/isHucwGIs8VZTc2jVrTqwqSWWND Vemvz41Q+wZjnB9KBAt4TexJUZlOWgZy/qfSg1yd3NSiyplCB+vMandlcbAzvz3DxKwi TIKOJKBNA7+aEGcl9vDjU3izPcGrIhqutNz/MjILbPAoQSboARDwe655ceNCABD7hSlj J54A== MIME-Version: 1.0 X-Received: by 10.194.80.7 with SMTP id n7mr5656511wjx.8.1397634354877; Wed, 16 Apr 2014 00:45:54 -0700 (PDT) Date: Wed, 16 Apr 2014 12:45:54 +0500 Subject: Attribute error while executing python script From: ali hanif To: python-list@python.org Content-Type: multipart/alternative; boundary=047d7beb9c803f9a1204f7241bb1 X-Mailman-Approved-At: Wed, 16 Apr 2014 09:47:56 +0200 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 765 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397634477 news.xs4all.nl 2953 [2001:888:2000:d::a6]:51844 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70322 --047d7beb9c803f9a1204f7241bb1 Content-Type: text/plain; charset=UTF-8 Hi i am a student and working on GNU..I have a python code which i want to run in GNU radio companion but i am unable to search for the right block to execute that code...can anyone help me with that??When I execute the same python code(not in GNU), I get the following error: AttributeError: 'top_block_sptr' object has no attribute 'wxgui_' If anyone knows about this,plz send a mail to alihanif799@gmail.com....thnx in advance..the code is as shown: #!/usr/bin/env pythonfrom gnuradio import blocksfrom gnuradio import eng_notationfrom gnuradio import grfrom gnuradio import uhd#from gnuradio import windowfrom gnuradio.eng_option import eng_option#from gnuradio.gr import firdesfrom gnuradio.wxgui import formsfrom gnuradio.wxgui import waterfallsink2from grc_gnuradio import wxgui as grc_wxguifrom optparse import OptionParserimport wx class top_block(grc_wxgui.top_block_gui): def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Top Block") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ### ############################################### self.variable_slider_1 = variable_slider_1 = 32 self.variable_slider_0 = variable_slider_0 = 0 self.samp_rate = samp_rate = 21e6 self.gain = gain = variable_slider_1 self.delay_length = delay_length= variable_slider_0 ################################################## # Blocks ################################################## self.wxgui_waterfallsink2_0_0 = waterfallsink2.waterfall_sink_c( self.GetWin(), baseband_freq=0, dynamic_range=100, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=512, fft_rate=15, average=False, avg_alpha=None, title="Output Waterfall Plot", ) self.GridAdd(self.wxgui_waterfallsink2_0_0.win, 0, 10, 10, 10) self.wxgui_ waterfallsink2_0 = waterfallsink2.waterfall_sink_c( self.GetWin(), baseband_freq=0, dynamic_range=100, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=512, fft_rate=15, average=False, avg_alpha=None, title="Input Waterfall Plot", ) self.GridAdd(self.wxgui_waterfallsink2_0.win, 0, 0, 10, 10) _variable_slider_1_sizer = wx.BoxSizer(wx.VERTICAL) self._variable_slider_1_text_box = forms.text_box( parent=self.GetWin(), sizer=_variable_slider_1_sizer, value=self.variable_slider_1, callback=self.set_variable_slider_1, label="Output Gain", converter=forms.float_converter(), proportion=0, ) self._variable_slider_1_slider = forms.slider( parent=self.GetWin(), sizer=_variable_slider_1_sizer, value=self.variable_slider_1, callback=self.set_variable_slider_1, minimum=0, maximum=32, num_steps=31, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.GridAdd(_variable_slider_1_sizer, 12, 10, 1, 9) _variable_sl ider_0_sizer = wx.BoxSizer(wx.VERTICAL) self._variable_slider_0_text_box = forms.text_box( parent=self.GetWin(), sizer=_variable_slider_0_sizer, value=self.variable_slider_0, callback=self.set_variable_slider_0, label="Delay Length", converter=forms.int_converter(), proportion=0, ) self._variable_slider_0_slider = forms.slider( parent=self.GetWin(), sizer=_variable_slider_0_sizer, value=self.variable_slider_0, callback=self.set_variable_slider_0, minimum=0, maximum=710000, num_steps=1000, style=wx.SL_HORIZONTAL, cast=int, proportion=1, ) self.GridAdd(_variable_slider_0_sizer, 10, 10, 1, 9) self.uhd_usrp_source_0 = uhd.usrp_source( device_addr="", stream_args=uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(2.28e9, 0) self.uhd_usrp_source_0.set_gain(0, 0) self.uhd_usrp_sink_0 = uhd.usrp_sink( device_addr="", stream_args =uhd.stream_args( cpu_format="fc32", channels=range(1), ), ) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_center_freq(2.28e9, 0) self.uhd_usrp_sink_0.set_gain(gain, 0) self.gr_file_source_0_0 = gr.file_source( gr.sizeof_gr_complex*1,"/home/ubuntu/radar-rx3.capture", True) self.gr_file_source_0 = gr.file_source(gr.sizeof_gr_complex*1,"/home/ubuntu/radar-rx3.capture", True) self.gr_delay_0_0 = gr.delay(gr.sizeof_gr_complex*1, delay_length) self.blocks_mult iply_xx_0 = blocks.multiply_vcc(1) ################################################## # Connections ################################################## self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_waterfallsink2_0, 0)) self.connect((self.gr_file_source_0_0, 0), (self.gr_delay_0_0, 0)) self.connect((self.gr_file_source_0, 0), (self.blocks_multiply_xx_0, 0)) self.connect((self.gr_delay_0_0, 0), (self.blocks_multiply_xx_0, 1)) self.connect((self.blocks_multiply_xx_0, 0), (self.uhd_usrp_sink_0, 0)) self.connect((self.blocks_multiply_xx_0, 0), (self.wxgui_waterfallsink2_0_0, 0)) def get_variable_slider_1(self): return self.variable_slider_1 def set_variable_slider_1(self, variable_slider_1): self.variable_slider_1 = variable_slider_1 self.set_gain(self.variable_slider_1) self._variable_slider_1_slider.set_value(self.variable_slider_1) self._variable_slider_1_text_box.set_value(self.variable_slider_1) def get_variable_slider_0(self): return self.variable_slider_0 def set_variable_slider_0(self, variable_slider_0): self.variable_slider_0 = variable_slider_0 self.set_delay_length(self.variable_slider_0) self._variable_slider_0_slider.set_value(self.variable_slider_0) self._variable_slider_0_text_box.set_value(self.variable_slider_0) def get_samp_rate(self): return self.samp_rate def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.wxgui_waterfallsink2_0.set_sample_rate(self.samp_rate) self.wxgui_waterfallsink2_0_0.set_sample_rate(self.samp_rate) self.uhd_usrp_sink_0.set_samp_rate(self.samp_rate) self.uhd_usrp_source_0.set_samp_rate(self.samp_rate) def get_gain(self): return self.gain def set_gain(self, gain): self.gain = gain self.uhd_usrp_sink_0.set_gain(self.gain, 0) def get_delay_length(self): return self.delay_length def set_delay_length(self, delay_length): self.delay_length = delay_length self.gr_delay_0_0.set_delay(self.delay_length)if __name__ == '__main__': parser = OptionParser(option_class=eng_option,usage="%prog: [options]") (options, args) = parser.parse_args() tb = top_block() tb.Run(True) ALI --047d7beb9c803f9a1204f7241bb1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi i am a student and working on GNU..I have a python code= which i want to run in GNU radio companion but i am unable to search for the right=20 block to execute that code...can anyone help me with that??When I=20 execute the same python code(not in GNU), I get the following error:

AttributeError: 'top_block_sptr' object has no attribute 'wx= gui_'

If anyone knows about this,plz send a mail to alihanif799@gmail.com....t= hnx in advance..the code is as shown:

#!/usr/bin/env python
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import uhd
#from gnuradio import window
from gnuradio.eng_option impor=
t eng_option
#from gnuradio.gr import firdes
from gnuradio.wxgui import forms
from gnuradio.wxgui import waterfallsink2
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionPar=
ser
import wx

class top_block(grc_wxgui.top_block_gui):
    def __init__(self):=

        grc_wxgui.top_block=
_gui.__init__(self, title=3D"=
;Top Block")
        _icon_path =3D "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.=
png"
        self.SetIcon=
(wx.Icon(_ico=
n_path, wx.BITMAP_TYPE_ANY))
        ###########################################=
#######
        # Variables
        ###
        ###########################################=
####
        self.variable_slide=
r_1 =3D variable_slider_1 <=
/span>=3D =
32
        self.variable_slide=
r_0 =3D variable_slider_0 <=
/span>=3D =
0
        self.samp_rate =3D samp_rate =3D 21e6
        self.gain =3D gain =3D=
 variable_slider_1
        self.delay_length <=
/span>=3D delay_length=3D variable_slider_0
        ###########################################=
#######
        # Blocks
        ###########################################=
#######
        self.wxgui_waterfal=
lsink2_0_0 =3D waterfallsin=
k2.waterfall_sink_c<=
span class=3D"">(
        self.GetWin<=
span class=3D"">(),
        baseband_freq=3D0,
        dynamic_range=3D100=
,
        ref_level=3D0,
        ref_scale=3D2.0,
        sample_rate=3Dsamp_=
rate,
        fft_size=3D512,
        fft_rate=3D15,
        average=3DFalse,
        avg_alpha=3DNone,
        title=3D"Outpu=
t Waterfall Plot",
        )
        self.GridAdd=
(self.wxgui_waterfallsink2_0_0.win, 0, 10, 10, 10)
        self.wxgui_
        waterfallsink2_0 =3D waterfallsink2.waterfall_=
sink_c(
        self.GetWin<=
span class=3D"">(),
        baseband_freq=3D0,
        dynamic_range=3D100=
,
        ref_level=3D0,
        ref_scale=3D2.0,
        sample_rate=3Dsamp_=
rate,
        fft_size=3D512,
        fft_rate=3D15,
        average=3DFalse,
        avg_alpha=3DNone,
        title=3D"Input=
 Waterfall Plot",
        )
        self.GridAdd=
(self.wxgui_waterfallsink2_0.<=
span class=3D"">win, 0, 0, 10, 10)
        _variable_slider_1_sizer =3D wx.BoxSizer(wx.VERTICAL)
        self._variable_slid=
er_1_text_box =3D forms.text_box(
        parent=3Dself.GetWin()=
,
        sizer=3D_variable_s=
lider_1_sizer,
        value=3Dself=
.variable_slider_1,
        callback=3Dself.set_variable_slider_1,
        label=3D"Outpu=
t Gain",
        converter=3Dforms.float_converter(),
        proportion=3D0,
        )
        self._variable_slid=
er_1_slider =3D forms.slider(<=
/span>
        parent=3Dself.GetWin()=
,
        sizer=3D_variable_s=
lider_1_sizer,
        value=3Dself=
.variable_slider_1,
        callback=3Dself.set_variable_slider_1,
        minimum=3D0<=
span class=3D"">,
        maximum=3D32=
,
        num_steps=3D31,
        style=3Dwx.SL_HORIZONTAL,
        cast=3Dfloat=
,
        proportion=3D1,
        )
        self.GridAdd=
(_variable_slider_1_sizer, 12<=
span class=3D"">, 10=
, 1=
, 9=
)
        _variable_sl
        ider_0_sizer =3D wx=
.BoxSizer(wx.VERTICAL)
        self._variable_slid=
er_0_text_box =3D forms.text_box(
        parent=3Dself.GetWin()=
,
        sizer=3D_variable_s=
lider_0_sizer,
        value=3Dself=
.variable_slider_0,
        callback=3Dself.set_variable_slider_0,
        label=3D"Delay=
 Length",
        converter=3Dforms.int_converter(),
        proportion=3D0,
        )
        self._variable_slid=
er_0_slider =3D forms.slider(<=
/span>
        parent=3Dself.GetWin()=
,
        sizer=3D_variable_s=
lider_0_sizer,
        value=3Dself=
.variable_slider_0,
        callback=3Dself.set_variable_slider_0,
        minimum=3D0<=
span class=3D"">,
        maximum=3D710000,
        num_steps=3D1000,
        style=3Dwx.SL_HORIZONTAL,
        cast=3Dint,
        proportion=3D1,
        )
        self.GridAdd=
(_variable_slider_0_sizer, 10<=
span class=3D"">, 10=
, 1=
, 9=
)
        self.uhd_usrp_sourc=
e_0 =3D uhd.usrp_source(
        device_addr=3D"=
;",
        stream_args=3Duhd.stream_args(
        cpu_format=3D"=
fc32",
        channels=3Drange(1),
        ),
        )
        self.uhd_usrp_sourc=
e_0.set_samp_rate(samp_rate)
        self.uhd_usrp_sourc=
e_0.set_center_freq<=
span class=3D"">(2.28e9, 0)
        self.uhd_usrp_sourc=
e_0.set_gain(0, 0)
        self.uhd_usrp_sink_=
0 =3D uhd.usrp_sink(
        device_addr=3D"=
;",
        stream_args
        =3Duhd.stream_args(
        cpu_format=3D"=
fc32",
        channels=3Drange(1),
        ),
        )
        self.uhd_usrp_sink_=
0.set_samp_rate(samp_rate)
        self.uhd_usrp_sink_=
0.set_center_freq(2.28e9, 0)
        self.uhd_usrp_sink_=
0.set_gain(gain, 0)
        self.gr_file_source=
_0_0 =3D gr.file_source(
        gr.sizeof_gr_comple=
x*1=
,
"/home/ubuntu/radar-rx3.capture", True)
        self.gr_file_source=
_0 =3D gr.file_source(<=
span class=3D"">gr.sizeof_g=
r_complex*1,
"/home/ubuntu/radar-rx3.capture", True)
        self.gr_delay_0_0 <=
/span>=3D gr.delay(gr.sizeof_gr_complex<=
/span>*1,<=
/span> delay_length)
        self.blocks_mult
        iply_xx_0 =3D block=
s.multiply_vcc(1)
        ###########################################=
#######
        # Connections
        ###########################################=
#######
        self.connect=
((self.uhd_usrp_source_0, 0), (self<=
span class=3D"">.wxgui_waterfallsink2_0, 0))
        self.connect=
((self.gr_file_source_0_0, 0), (self=
.gr_delay_0_0, 0))
        self.connect=
((self.gr_file_source_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect=
((self.gr_delay_0_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect=
((self.blocks_multiply_xx_0, 0),<=
span class=3D""> (self.uhd_usrp_sink_0, 0))
        self.connect=
((self.blocks_multiply_xx_0, 0),<=
span class=3D""> (self.wxgui_waterfallsink2_0_0=
, 0=
))
    def get_variable_slider=
_1(self):
        return self<=
span class=3D"">.variable_slider_1
    def set_variable_slider=
_1(self, variable_slider_1):=

        self.variable_slide=
r_1 =3D variable_slider_1
        self.set_gain(self.variable_slider_1)
        self._variable_slid=
er_1_slider.set_value(self.variable_slider_1)
        self._variable_slid=
er_1_text_box.set_value(self.<=
/span>variable_slider_1)

    def get_variable_slider=
_0(self):
        return self<=
span class=3D"">.variable_slider_0
    def set_variable_slider=
_0(self, variable_slider_0):=

        self.variable_slide=
r_0 =3D variable_slider_0
        self.set_delay_leng=
th(self.variable_slider_0)
        self._variable_slid=
er_0_slider.set_value(self.variable_slider_0)
        self._variable_slid=
er_0_text_box.set_value(self.<=
/span>variable_slider_0)
    def get_samp_rate(self):
        return self<=
span class=3D"">.samp_rate
    def set_samp_rate(self, samp_rate):
        self.samp_rate =3D samp_rate
        self.wxgui_waterfal=
lsink2_0.set_sample_rate(self.=
samp_rate)
        self.wxgui_waterfal=
lsink2_0_0.set_sample_rate<=
/span>(self.samp_rate)
        self.uhd_usrp_sink_=
0.set_samp_rate(self.samp_rate)
        self.uhd_usrp_sourc=
e_0.set_samp_rate(self.=
samp_rate)
    def get_gain(self):=

        return self<=
span class=3D"">.gain
    def set_gain(self,<=
span class=3D""> gain):
        self.gain =3D gain
        self.uhd_usrp_sink_=
0.set_gain(self.gain, 0)
    def get_delay_length(self)=
:
        return self<=
span class=3D"">.delay_length
    def set_delay_length(self,=
 delay_length):
        self.delay_length <=
/span>=3D delay_length
        self.gr_delay_0_0.set_delay(self.delay_length)
if __name__ =3D=3D '__main=
__':
    parser =3D OptionParser(op=
tion_class=3Deng_option,usage=
=3D"%prog: [options]")
    (options, args) =3D parser.parse_args()
    tb =3D top_block=
()
    tb.Run(True)

ALI
--047d7beb9c803f9a1204f7241bb1--