Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70322

Attribute error while executing python script

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 <alihanif799@gmail.com>
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 <alihanif799@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9316.1397634477.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Attribute error while executing python script ali hanif <alihanif799@gmail.com> - 2014-04-16 12:45 +0500

csiph-web