# NOOB needs help with simple.py

**URL:** <https://www.ruby-forum.com/t/noob-needs-help-with-simple-py/230729>\
**Category:** GNU Radio\
**Created:** [July 1, 2014, 10:25pm UTC](https://www.ruby-forum.com/t/noob-needs-help-with-simple-py/230729 "2014-07-01T22:25:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [July 1, 2014, 10:25pm UTC](https://www.ruby-forum.com/t/noob-needs-help-with-simple-py/230729/1 "2014-07-01T22:25:32Z")

</div>

Hi all,

I wanna work into this project, as I think its excellent!  
My box is a gentoo box running

net-wireless/gnuradio-3.7.3:0/3.7.3 USE=“alsa analog digital examples  
fcd filter grc pager qt4 sdl uhd utils wavelet wxwidgets -doc -jack -oss  
-performance-counters -portaudio” PYTHON\_SINGLE\_TARGET=“python2\_7”  
PYTHON\_TARGETS=“python2\_7”

For the first experiments I found this page giving a scope and fft  
display of the soundcard input,

[http://www.funwithelectronics.com/?id=10](http://www.funwithelectronics.com/?id=10)

the py file looks like this

#!/usr/bin/env python

from gnuradio import gr  
from gnuradio.wxgui import stdgui2,fftsink2,scopesink2  
import wx

class gnuradioGUI(stdgui2.std\_top\_block):  
def **init** (self,frame,panel,vbox,argv):  
stdgui2.std\_top\_block. **init** (self,frame,panel,vbox,argv)

```
fft = fftsink2.fft_sink_f(panel, title="FFT display", fft_size=512, 

```

sample\_rate=100000)  
vbox.Add(fft.win,4,wx.EXPAND)

```
scope = scopesink2.scope_sink_f(panel, title="Oscilloscope", 

```

sample\_rate=100000)  
vbox.Add(scope.win,4,wx.EXPAND)

```
signal = gr.sig_source_f(100000,gr.GR_SIN_WAVE,20000,1000,0)
throttle = gr.throttle(gr.sizeof_float,100000)
self.connect(signal,throttle)
self.connect(throttle,fft)
self.connect(throttle,scope)

```

if **name** == ‘ **main** ’:  
app = stdgui2.stdapp(gnuradioGUI,“A simple GNU Radio GUI”)  
app.MainLoop()

when I try to start this

#python2.7 simple.py

Using Volk machine: avx\_32\_mmx\_orc  
Traceback (most recent call last):  
File “./simplegui.py”, line 25, in   
app = stdgui2.stdapp(gnuradioGUI,“A simple GNU Radio GUI”)  
File “/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,  
line 46, in **init**  
wx.App. **init** (self, redirect=False)  
File  
“/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/\_core.py”, line  
7981, in **init**  
self.\_BootstrapApp()  
File  
“/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/\_core.py”, line  
7555, in \_BootstrapApp  
return _core_.PyApp\_\_BootstrapApp(\*args, \*\*kwargs)  
File “/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,  
line 49, in OnInit  
frame = stdframe (self.top\_block\_maker, self.title, self.\_nstatus)  
File “/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,  
line 76, in **init**  
self.panel = stdpanel (self, self, top\_block\_maker)  
File “/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,  
line 98, in **init**  
self.top\_block = top\_block\_maker (frame, self, vbox, sys.argv)  
File “./simplegui.py”, line 18, in **init**  
signal = gr.sig\_source\_f(100000,gr.GR\_SIN\_WAVE,20000,1000,0)  
AttributeError: ‘module’ object has no attribute ‘sig\_source\_f’

but then nothing is displayed

can someone experienced please give me a hint??

---

<div class="post-metadata">

**Author:** ![Sebastian\_Heyn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3d9bf3/32.png) [@Sebastian\_Heyn](https://www.ruby-forum.com/u/Sebastian_Heyn)\
**Post date:** [July 1, 2014, 10:39pm UTC](https://www.ruby-forum.com/t/noob-needs-help-with-simple-py/230729/2 "2014-07-01T22:39:14Z")

</div>

Hi Sebastian,  
I admit I did not go through your whole post, since that would require  
reading someone else’s python. Most likely, that website is for an older  
version of GNU Radio, and that’s why you can’t import some stuff;  
gr.block\_name looks like pre-3.7 GNU Radio.

I always encourage people to start off with the beginners’ tutorials[1]  
over at [gnuradio.org](http://gnuradio.org), since we, as a community, try to make sure that  
they don’t become obsolete, and only look at tutorials elsewhere once  
they are used to GNU Radio enough to understand what’s going on with a  
little research themselves.

So: do not be discouraged to continue learning, it’s really fun and  
rewarding!  
Happy Hacking,  
Marcus

[1] [http://gnuradio.org/redmine/projects/gnuradio/wiki/Tutorials](http://gnuradio.org/redmine/projects/gnuradio/wiki/Tutorials)  
As soon as you reach the WritePythonApplications tutorial, they even  
have the signal-to-soundcard example, so no need to look elsewhere 😉

---

<div class="post-metadata">

**Author:** ![Sebastian\_Heyn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3d9bf3/32.png) [@Sebastian\_Heyn](https://www.ruby-forum.com/u/Sebastian_Heyn)\
**Post date:** [July 2, 2014, 8:45am UTC](https://www.ruby-forum.com/t/noob-needs-help-with-simple-py/230729/3 "2014-07-02T08:45:58Z")

</div>

Hi Marcus,

thanks for your honest words.

I figured out howto do it using the grc. Its an interesting tool, and  
results can be achieved quickly, even if the problem requires a rather  
complex flow.

I am sure I’ll nag about other problems sooner or later :-))

* * *

Marcus M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) schrieb am Di, 1.7.2014:

Betreff: Re: [Discuss-gnuradio] NOOB needs help with simple.py  
An: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Datum: Dienstag, 1. Juli, 2014 22:37 Uhr

Hi Sebastian,  
I admit I did not go through your whole post,  
since that would require  
reading someone  
else’s python. Most likely, that website is for an  
older  
version of GNU Radio, and that’s  
why you can’t import some stuff;  
gr.block\_name looks like pre-3.7 GNU Radio.

I always encourage people to  
start off with the beginners’ tutorials[1]  
over at [gnuradio.org](http://gnuradio.org), since we, as a community,  
try to make sure that  
they don’t become  
obsolete, and only look at tutorials elsewhere once  
they are used to GNU Radio enough to understand  
what’s going on with a  
little research  
themselves.

So: do not be  
discouraged to continue learning, it’s really fun and  
rewarding!  
Happy Hacking,  
Marcus

[1] [http://gnuradio.org/redmine/projects/gnuradio/wiki/Tutorials](http://gnuradio.org/redmine/projects/gnuradio/wiki/Tutorials)  
As soon as you reach the  
WritePythonApplications tutorial, they even  
have the signal-to-soundcard example, so no  
need to look elsewhere 😉

On 01.07.2014 22:20, Sebastian  
Heyn wrote:

> Hi all,
> 
> I wanna work into  
> this project, as I think its excellent!

My box is a gentoo box running

> net-wireless/gnuradio-3.7.3:0/3.7.3  
> USE=“alsa analog digital examples fcd filter grc pager  
> qt4 sdl uhd utils wavelet wxwidgets -doc -jack -oss  
> -performance-counters -portaudio”  
> PYTHON\_SINGLE\_TARGET=“python2\_7”  
> PYTHON\_TARGETS=“python2\_7”

For the first experiments I found this page giving a scope  
and fft display of the soundcard input,

> 

[Make a simple GNU Radio GUI - Fun With Electronics](http://www.funwithelectronics.com/?id=10)

> the py file looks  
> like this

#!/usr/bin/env python

> from gnuradio import gr  
> from gnuradio.wxgui import  
> stdgui2,fftsink2,scopesink2  
> import  
> wx
> 
> class  
> gnuradioGUI(stdgui2.std\_top\_block):

def **init** (self,frame,panel,vbox,argv):

> 

stdgui2.std\_top\_block. **init** (self,frame,panel,vbox,argv)

> 

fft = fftsink2.fft\_sink\_f(panel, title=“FFT  
display”, fft\_size=512, sample\_rate=100000)

> 

vbox.Add(fft.win,4,wx.EXPAND)

> 

> 

scope = scopesink2.scope\_sink\_f(panel,  
title=“Oscilloscope”, sample\_rate=100000)

> 

vbox.Add(scope.win,4,wx.EXPAND)

> 

> signal =  
> gr.sig\_source\_f(100000,gr.GR\_SIN\_WAVE,20000,1000,0)  
> throttle =  
> gr.throttle(gr.sizeof\_float,100000)

self.connect(signal,throttle)

> 

self.connect(throttle,fft)

> 

self.connect(throttle,scope)

> if **name** == ‘ **main** ’:  
> app =  
> stdgui2.stdapp(gnuradioGUI,“A simple GNU Radio  
> GUI”)  
> app.MainLoop()

when I try to start this

> #python2.7 simple.py
> 
> Using Volk machine:  
> avx\_32\_mmx\_orc  
> Traceback (most recent  
> call last):  
> File  
> “./simplegui.py”, line 25, in   
> app =  
> stdgui2.stdapp(gnuradioGUI,“A simple GNU Radio  
> GUI”)  
> File  
> “/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,  
> line 46, in **init**

wx.App. **init** (self, redirect=False)

> File  
> “/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/\_core.py”,  
> line 7981, in **init**

self.\_BootstrapApp()

> File  
> “/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/\_core.py”,  
> line 7555, in \_BootstrapApp

return _core_.PyApp\_\_BootstrapApp(\*args,  
\*\*kwargs)

> File  
> “/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,  
> line 49, in OnInit

frame = stdframe (self.top\_block\_maker,  
self.title, self.\_nstatus)

> File  
> “/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,  
> line 76, in **init**

self.panel = stdpanel (self, self,  
top\_block\_maker)

> File  
> “/usr/lib/python2.7/site-packages/gnuradio/wxgui/stdgui2.py”,  
> line 98, in **init**

self.top\_block = top\_block\_maker (frame, self,  
vbox, sys.argv)

> File  
> “./simplegui.py”, line 18, in **init**  
> signal =  
> gr.sig\_source\_f(100000,gr.GR\_SIN\_WAVE,20000,1000,0)  
> AttributeError: ‘module’ object  
> has no attribute ‘sig\_source\_f’
> 
> but then nothing is  
> displayed
> 
> can  
> someone experienced please give me a hint??

* * *

> Discuss-gnuradio mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

* * *

Discuss-gnuradio mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)
