discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] AttributeError: 'module' object has no attribute


From: Abhinav Jadon
Subject: Re: [Discuss-gnuradio] AttributeError: 'module' object has no attribute 'hamming'
Date: Tue, 17 Feb 2015 21:34:08 +0530

Hi , 
Sorry for not providing all the info . I dont know what happened to the link though .
I used gr_modtool to create the OOT module ;
I wrote the module in C++ and i am using GNU Radio 3.7.6
I have created a git repository : https://github.com/Jadoobaba/gr-wsi/tree/master/Documents/gr-wsi

ldd on the .so file has the following output .
address@hidden:/usr/local/lib$ ldd libgnuradio-wsi.so
    linux-vdso.so.1 =>  (0x00007fffc59fe000)
    libboost_system.so.1.53.0 => /usr/lib/x86_64-linux-gnu/libboost_system.so.1.53.0 (0x00007f79fc959000)
    libgnuradio-runtime-3.7.6.1.so.0.0.0 => /usr/local/lib/libgnuradio-runtime-3.7.6.1.so.0.0.0 (0x00007f79fc689000)
    libgnuradio-pmt-3.7.6.1.so.0.0.0 => /usr/local/lib/libgnuradio-pmt-3.7.6.1.so.0.0.0 (0x00007f79fc440000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f79fc13c000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f79fbf26000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f79fbb5d000)
    libvolk.so.0.0.0 => /usr/local/lib/libvolk.so.0.0.0 (0x00007f79fb80f000)
    libboost_filesystem.so.1.53.0 => /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.53.0 (0x00007f79fb5f9000)
    libboost_thread.so.1.53.0 => /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.53.0 (0x00007f79fb3e2000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f79fb1c5000)
    liblog4cpp.so.5 => /usr/lib/liblog4cpp.so.5 (0x00007f79faf85000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f79fad7c000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f79faa78000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f79fcd87000)
    liborc-0.4.so.0 => /usr/lib/x86_64-linux-gnu/liborc-0.4.so.0 (0x00007f79fa7f8000)
    libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007f79fa5de000)


While running gdb --args python hamming.py has the following result .
(gdb) run
Starting program: /usr/bin/python hamming.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe2576700 (LWP 4704)]
[New Thread 0x7fffe1d75700 (LWP 4705)]
[New Thread 0x7fffe0a9a700 (LWP 4706)]
[New Thread 0x7fffd3fff700 (LWP 4707)]
[New Thread 0x7fffd37fe700 (LWP 4708)]
Traceback (most recent call last):
  File "hamming.py", line 62, in <module>
    tb = hamming()
  File "hamming.py", line 33, in __init__
    self.wsi_hamming_0 = wsi.hamming(3)
AttributeError: 'module' object has no attribute 'hamming'
[Thread 0x7fffd37fe700 (LWP 4708) exited]
[Thread 0x7fffe0a9a700 (LWP 4706) exited]
[Thread 0x7fffe1d75700 (LWP 4705) exited]
[Thread 0x7fffe2576700 (LWP 4704) exited]
[Thread 0x7ffff7fd6740 (LWP 4699) exited]
[Inferior 1 (process 4699) exited with code 01]



Thanks in advance
Abhinav Jadon

 

On Tue, Feb 17, 2015 at 8:37 PM, Tom Rondeau <address@hidden> wrote:
On Sat, Feb 14, 2015 at 6:41 PM, Richard Bell <address@hidden> wrote:
I ran into this myself with a custom Python block. I was unable to resolve it. I gave up. Interested to learn a fix as well. 

I don't think this is a Python block since he's linking against ITPP, but it's not specified in his original question, so I can't be sure.

Anyways, I just tried making a Python block in an OOT project and it works just fine.

$ gr_modtool nm
Name of the new module: testpy
Creating out-of-tree module in ./gr-testpy... Done.
Use 'gr_modtool add' to add a new block to this currently empty module.

$ cd gr-testpy
$ gr_modtool add
GNU Radio module name identified: testpy
('sink', 'source', 'sync', 'decimator', 'interpolator', 'general', 'tagged_stream', 'hier', 'noblock')
Enter block type: sync
Language (python/cpp): python
Language: Python
Enter name of block/code (without module name prefix): test01
Block/code identifier: test01
Enter valid argument list, including default arguments: 
Add Python QA code? [Y/n] 
Adding file 'python/test01.py'...
Adding file 'python/qa_test01.py'...
Editing python/CMakeLists.txt...
Adding file 'grc/testpy_test01.xml'...
Editing grc/CMakeLists.txt...

<edited the test01.py file and set it to use float input and float output>

$ mkdir build; cd build
$ cmake -DCMAKE_INSTALL_PREFIX=/opt/gr ../
$ make
$ make install
$ ipython
In [1]: import testpy

In [2]: dir(testpy)
Out[2]: 
['__builtins__',
 '__doc__',
 '__file__',
 '__name__',
 '__package__',
 '__path__',
 'test01']

In [3]: a = testpy.test01()



Worked fine. You're not the only person with this problem, but no one has yet shown me how to reproduce the error.

Tom

 
On Feb 13, 2015, at 11:17 PM, Abhinav Jadon <address@hidden> wrote:

Hi ,
I wrote a Out of Tree module for hamming code using ITPP library . It compiled when i ran the cmake.. , make and make install commands without error . I used the block in a flowgraph and the python script thus generated throws an error while executing it which looks like this .

Traceback (most recent call last):
  File "/home/iiitd/Desktop/hamming.py", line 62, in <module>
    tb = hamming()
  File "/home/iiitd/Desktop/hamming.py", line 33, in __init__
    self.wsi_hamming_0 = wsi.hamming(3)
AttributeError: 'module' object has no attribute 'hamming'

I then checked the $PYTHONPATH and made sure it points to the directory where the files associated with the block are installed during make install ie /usr/local/lib/python2.7/dist-packages instead to /opt/qt/lib/python2.7/dist-packages .


It would be really thankful if somebody helps me sort this out .


Thanks
Abhinav Jadon 




--
Abhinav PS Jadon
2012122
Btech 2016-ECE


reply via email to

[Prev in Thread] Current Thread [Next in Thread]