Here is what my *__init__.py* looked like prior to changes:

*try:*
*    from test_swig import **
*except ImportError:*
*    pass*

*from qpsk_demod_py_cb import qpsk_demod_py_cb   *       <--- my block

And after the adding the change you suggested:

*try:*
*    from test_swig import **
*except ImportError:*
*    pass*

*from qpsk_demod_py_cb import **

After running make again, installing and sudo ldconfig, this has not fixed
the AttributeError I see in gnuradio-companion.

Rich

On Fri, Jan 30, 2015 at 2:38 AM, Tom Rondeau <t...@trondeau.com> wrote:

> On Fri, Jan 30, 2015 at 5:31 AM, Ludwig Stephan (CR/AEH4) <
> stephan.ludw...@de.bosch.com> wrote:
>
>>  Hi Tom,
>>
>>
>>
>> as far as I understood the original post, we talk about pure python
>> blocks, hence no impl.cc file. My experience is that gr_modtool makexml
>> does not work for these blocks. I will try to reproduce the effect and will
>> post this – but not before mid of next week.
>>
>>
>>
>> Regards
>>
>> Stephan
>>
>
> Ahh! Thanks for pointing that out. I had missed the fact that it was a
> Python block (and I rarely work with them myself).
>
> Ok, I think the fix for that is to add a "from x import *" into the
> __init__.py file for the module where x is your Python block. We should
> test this and add it to gr_modtool to avoid this confusion in the future.
>
> Tom
>
>
>
>
>>
>>
>> *Von:* trond...@trondeau.com [mailto:trond...@trondeau.com] *Im Auftrag
>> von *Tom Rondeau
>>
>> *Gesendet:* Freitag, 30. Januar 2015 09:45
>> *An:* Ludwig Stephan (CR/AEH4)
>> *Cc:* Richard Bell; discuss-gnuradio@gnu.org
>> *Betreff:* Re: [Discuss-gnuradio] OOT Python Block
>>
>>
>>
>> On Fri, Jan 30, 2015 at 2:03 AM, Ludwig Stephan (CR/AEH4) <
>> stephan.ludw...@de.bosch.com> wrote:
>>
>> Hi Richard,
>>
>>
>>
>> I noticed the same problem with some blocks in my own OOT module. I do
>> not know why, but if you change the lines in the GRC file to (if not
>> already done)
>>
>> <import> import my_module.my_block_name_here</import>
>>
>> <make>my_module.my_block_name_here.my_block_name_here(…)</make>
>>
>>
>>
>> (note the double block_name in <make>)
>>
>>
>>
>> I do not remember right, but it might also be sufficient to change only
>> either one of the lines (you have to try on your own).
>>
>> You can try by calling the from python. E.g. IPython has tab completion
>> and you can see  by import my_module.<tab> (and so on for the make line),
>> what block is how accessible.
>>
>>
>>
>> Regards Stephan
>>
>>
>>
>>
>>
>> That can't be right. You really shouldn't have to do that to get the
>> block to work.
>>
>>
>>
>> We periodically get this bug from our users, no one has ever explained
>> how to reproduce it, and I've never seen this failure mode myself. As long
>> as you used gr_modtool and made the necessary changes to the files -- which
>> really just means fixing the <+...+> in the impl.cc file -- then it should
>> just "work".
>>
>>
>>
>> Tom
>>
>>
>>
>>
>>
>>
>>
>>  *Gesendet:* Donnerstag, 29. Januar 2015 23:22
>>
>> *An:* discuss-gnuradio@gnu.org
>> *Betreff:* [Discuss-gnuradio] OOT Python Block
>>
>>
>>
>> I've created a python block that I've tested via command line. It passes
>> all qa tests. I've also created an xml file for it and installed it. I
>> followed every step the OOT Python Tutorial explains.
>>
>>
>>
>> I see the category and block in gnuradio-companion. When I use my block
>> in a flowgraph, upon to executing the graph I get
>>
>>
>>
>> *AttirbuteError: 'module' object has no attribute '<my_module_name_here>'*
>>
>>
>>
>> I've added the block build location to the PYTHONPATH variable and
>> confirmed that I can import my module at a python command line.
>>
>>
>>
>> What do I not have set correctly and what is this error telling me?
>>
>>
>>
>> Thanks,
>>
>> Rich
>>
>>
>> _______________________________________________
>> Discuss-gnuradio mailing list
>> Discuss-gnuradio@gnu.org
>> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>>
>>
>>
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to