Attribute error while executing python script

Chris Angelico rosuav at gmail.com
Wed Apr 16 04:12:00 EDT 2014


On Wed, Apr 16, 2014 at 5:45 PM, ali hanif <alihanif799 at gmail.com> wrote:
> 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 at gmail.com....thnx
> in advance..the code is as shown:

Several points. I'll get to the one that you asked about.

Firstly, please don't ask us to send you direct mail. I'm letting you
off on that one and cc'ing you, but a lot of people won't. If you want
a response, read the newsgroup/mailing list; that's what participation
means. (There are a few lists where cc'ing is the convention, so you
don't have to subscribe to hear the responses. This is not normal for
mailing lists, and definitely not for newsgroups, so it's safer to
assume you have to join.)

Secondly: "GNU" is a project and an operating system, not a particular
program. See http://www.gnu.org/ for more info. You're talking about
"GNU Radio Companion", which may be either
http://gnuradio.org/redmine/projects/gnuradio/wiki or
http://gnuradio.org/redmine/projects/gnuradio/wiki/GNURadioCompanion
and is not really clear. Posting a link to what you're talking about
would help enormously.

Thirdly: When you get an error from Python, it comes with a full
traceback, pinpointing the failing line. Copy and paste the entire
traceback, not just the final line, as it helps us significantly. (But
in this case, I did figure out what was going on.)

Finally, you'll find it a lot easier to debug programs if you cut the
problem code down. Check out http://www.sscce.org/ for more info on
that. Often you'll find the problem yourself as you cut the code down;
if not, you can at least post a short, simple snippet, which we can
more easily debug. (Note that sometimes a problem really does depend
on the size of the code. I've had some of these. But then you can
still post your results: "deleting any line from this code prevents
the bug from happening".)

>         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",
>         )

The layout here is what's tripping you up. Either your mailer has
destroyed structure, or this is almost unreadably tangled. And it
results in this next problem:

>         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",
>         )

You've broken this in a place that doesn't work. The traceback points
you exactly to the failing line, and that's where the problem exists.

ChrisA



More information about the Python-list mailing list