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: Tom Rondeau
Subject: Re: [Discuss-gnuradio] AttributeError: 'module' object has no attribute 'hamming'
Date: Tue, 17 Feb 2015 10:07:44 -0500

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 


reply via email to

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