Running a GNU Radio Companion generated code

Hi people,

Sorry for the dummy question, but I didn’t find a simple and direct
answer searching around for this. (Not need to say also that I am just
starting with GNU Radio… :slight_smile:

OK I have a code, generated with Gnu radio companion that i want to
run
over the command line to follow with GDB. I was under the impression
that
if I simply got the code generated in the ~/.grc_gnuradio, add the


def main():
“”" go, go, go “”"
top_block = CLASS
top_block.run()
if name == “main”:
print ‘Blocked waiting for GDB attach (pid = %d)’ % (os.getpid(),)
raw_input ('Press Enter to continue: ')
main()

as stated at
https://gnuradio.org/redmine/projects/gnuradio/wiki/TutorialsDebugging
it
would run to attach GDB. However, i am getting the following error:


Traceback (most recent call last):
File “ieee802_15_4_phy.py”, line 120, in
main()
File “ieee802_15_4_phy.py”, line 115, in main
top_block.run()
File
“/usr/local/lib/python2.7/dist-packages/gnuradio/gr/hier_block2.py”,
line 53, in getattr
return getattr(self._hb, name)
AttributeError: ‘hier_block2_sptr’ object has no attribute ‘run’

The code runs correctly on Gnuradio companion! No problem whatsoever!
Which would be the correct way to run the code auto-generated by
gnuradio
companion in a stand alone way?

Thanks in advance…

       Daniel


Best regards…

                 Daniel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Daniel,

OK I have a code, generated with Gnu radio companion that i want
to run over the command line to follow with GDB. I was under the
impression that if I simply got the code generated in the
~/.grc_gnuradio, add the
This folder usually only contains ‘hier_blocks’. Executable flowgraph
pythons files are usually created in the same folder your .grc file is
located in.


|def main(): “”" go, go, go “”" top_block = CLASS
top_block.run()
Did you replace a class by [Class]? According to the Tutorial it
expects an object of type gr.top_block in this line.

if name == “main”: print ‘Blocked waiting for GDB attach
(pid = %d)’ % (os.getpid(),) raw_input ('Press Enter to continue:
') main() ---- |

as stated at
https://gnuradio.org/redmine/projects/gnuradio/wiki/TutorialsDebugging

it would run to attach GDB. However, i am getting the following error:

— Traceback (most recent call last): File “ieee802_15_4_phy.py”,
line 120, in main() File “ieee802_15_4_phy.py”, line 115,
in main top_block.run() File
“/usr/local/lib/python2.7/dist-packages/gnuradio/gr/hier_block2.py”,

line 53, in getattr

return getattr(self._hb, name) AttributeError: ‘hier_block2_sptr’
object has no attribute ‘run’
You try to call run on a ‘hier_block’. ‘run’ is a member of
‘gr.top_block’. top_block contains the scheduler and takes care of
correct initialization etc. So it is essentially the flowgraph.

I hope I could give you some hints on what might go wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJUmDfBAAoJEO7fmkDsqywMbyoQAKyANgElQ64/Ox81/gwl4TOY
k3NCr9Stj8CEUG65bYBPo4eDoVT5+xyA7e4HYTYrKMlHT+J2c/iG3ckH9sK7khoO
1jpFOtQn688tih6uBRhlVgNKWH26B2Hia8U4zIzavDcnt+B3aIRm+MG19Zlg6Ggg
XLD9KeJ6A5nfgrx+jsylAZGWmp4u6ZFupAVjuTA0vHab/3BOjCuJq2IOveWtSfhg
gPoHowIvWFwuiR/owJjwHhSGyCmZU1/Iz3yGT0TLdOZ8odlP0z9braIOt2bT3x9V
OQzgpQFBVuEEdSRJETZkWw0Lr4Jwl/Bko9pHi3tj6MGEcq8U6fP4Ml8dhiG1IE9q
UZ9XdSNJqDBNylfRxsyBm1oBmUV/gF6mXpD3851lQLdTNvP3R2QD7QrFP9UxRPKj
c300eaCsRhucDT7ApQmqTguPeL8ds+z6eN8BZ41BtD9etBPjbJDjoV+hfk4z16jF
gHEjVTAKti2OCiyya19xb67XJoufNz3Fjn09idG7YDAYRG7Qvn3XZCUpLAzO79pg
axceRvfxgMqws21NgTEDiEndDxjEeJm0mh1jcNUwoM6vlRar/JbEwRxPSCuvfUdx
GQac8LmkYJsROja1UgADE06fTEJZtLWUEQqBXhKlBlQz6sx1OA42XU8PPDm5c3SY
AQfwe85pgdf1nQY19UEv
=wYmS
-----END PGP SIGNATURE-----

Hi Johannes,

THANKS a lot!!! Yes you did really helped, as you said I was trying
to
run the wrong .py!!! The example generates two .py on on the main
directory, as you said, and another on the ~/.grc_gnuradio. I had seen
somewhere that gnuradio companion generate code on the ~/.grc_gnuradio.
I
looked, the code was there, I didn’t even think it could have also
generated other part of the code on the same directory of the .grc. It
was
naive, sorry.

I managed to run and connect gdb to it, using the PID. Now things will
become really interesting, i.e.e me fighting with gdb, and the
breakpoints,
to understand the values it passes through the code ;).

Thanks again Johannes, for taking your time to answer! :slight_smile:

Best regards…

   Daniel

On Mon, Dec 22, 2014 at 4:24 PM, Johannes D. [email protected]
wrote:

This folder usually only contains ‘hier_blocks’. Executable flowgraph

‘gr.top_block’. top_block contains the scheduler and takes care of
gPoHowIvWFwuiR/owJjwHhSGyCmZU1/Iz3yGT0TLdOZ8odlP0z9braIOt2bT3x9V


Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page


Best regards…

                 Daniel