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: Simone Ciccia S210664
Subject: Re: [Discuss-gnuradio] AttributeError: 'module' object has no attribute 'block_name'
Date: Wed, 03 Sep 2014 15:57:02 +0200
User-agent: RoundCube Webmail/0.2.1

Very thanks for the immediate answer,

Sorry, I forgot that I passed two arguments when the block was created:

        $insert valid arguments: float reference, float alpha

while "unsigned int d_counter" is a normal variable initialized in the
constructor. 

now, in the file power_control_impl.h (in short) I added the variables:

    class power_control_impl : public power_control
    {
     private:
        float d_alpha, d_ref;
        unsigned int d_counter;


and then, in the constructor of the file power_control_impl.cc (in short) I
used the settler:

    power_control_impl::power_control_impl(float alpha, float reference)
      : gr::block("power_control",gr::io_signature::make2(2, 2,
sizeof(float), sizeof(float)),
              gr::io_signature::make(1, 1, sizeof(float))), d_alpha(alpha),
d_ref(reference)
        {
         d_counter=0
        }


the xml file (in short) I think is ok:

 <make>PWagc.power_control($alpha, $reference)</make>
  <param>
    <name>Alpha</name>
    <key>alpha</key>
    <type>float</type>
  </param>
  <param>
    <name>Reference</name>
    <key>reference</key>
    <type>float</type>
  </param>


is there something in the wrong place?
thanks for the help! 
Simone




On Wed, 3 Sep 2014 09:35:35 -0400, Tom Rondeau <address@hidden> wrote:
> On Wed, Sep 3, 2014 at 9:17 AM, Simone Ciccia S210664 <
> address@hidden> wrote:
> 
>> Hi,
>> I created a C++ block with gr_modtool,
>> following the commands:
>>
>> $ gr_modtool newmod PWagc
>> $ gr_modtool add -t general power_control
>>
>> I written and compiled my block with commands:
>>
>> $cmake ../ && make && sudo make install && sudo ldconfig
>>
>> Until this point all seems ok, but when I open gnuradio and try to
>> simulate
>> my block...
>> the following error appears:
>>
>> Traceback (most recent call last):
>>   File "/home/simone/Scrivania/top_block.py", line 261, in <module>
>>     tb = top_block(address=options.address)
>>   File "/home/simone/Scrivania/top_block.py", line 153, in __init__
>>     self.PWagc_power_control_0 = PWagc.power_control(0.001, 0.25)
>> AttributeError: 'module' object has no attribute 'power_control'
>>
>>
>> I'm not able to understand from which this error derive...
>> If needed, I can attach the _impl.cc etc... files.
>>
>> My gnuradio version is the 3.7.4 and
>> PYTHONPATH=/usr/local/lib/python2.7/dist-packages,
>> in this last folder I can see the installed gr-PWagc directory.
>>
>> Someone can help me please?
>> If additional information are needed, please ask me... I'm blocked here!
>>
>> Thanks,
>> Simone Ciccia
>>
> 
> We've been seeing this issue from a few people recently. I can't
duplicate
> the problem. I just did exactly what you did above, though the work
> function doesn't actually do anything.
> 
> Are you potentially adding some interface setter or getter to the class
and
> not putting it in all the right places (pure virtual in the public
header,
> then again in the private header, and implemented in the source file)?
> 
> Have you added QA code? In qa_power_control.py, just add a line to the
test
> function to create the PWagc.power_control(x,y) and see if it works
there.
> 
> Tom



reply via email to

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