Monday, December 18, 2017

Re: [Discuss-gnuradio] Instantiating a C++ object derived from `boost::enable_shared_from_this' from Python

Hi Frank - Yes this is a SWIG issue. You need the code as found here: <
https://github.com/gnuradio/gnuradio/blob/master/gr-digital/swig/constellation.i
>. There is a specific line for the base class, then a pattern used for
any inheriting class. Should be self-obvious how to tweak them for your
specific needs. Hope this is useful! - MLD

On Mon, Dec 18, 2017, at 07:59 AM, Frank Restuccia wrote:
> I am trying to instantiate a C++ object from Python as follows.
> [snip]
> /************************/
>
> I am instantiating the module in the Python file as follows:
>
>         a = common_modules.constellation_cqpsk()
>
> This is what I am getting:
>
>   File "./custom_ofdm_system_covert.py", line 12, in <module>
>     from custom_ofdm_txer_covert import custom_ofdm_txer_covert
>   File
> "/home/frank/Documents/reconfigurable_ofdm/gr-custom_tx_ofdm/python/custom_ofdm_txer_covert.py",
> line 14, in <module>
>     import common_modules_swig as common_modules
>   File
> "/home/frank/Documents/reconfigurable_ofdm/gr-common_modules/build/swig/common_modules_swig.py",
> line 238, in <module>
>     constellation_cbpsk = constellation_cbpsk.make;
> NameError: name 'constellation_cbpsk' is not defined
>
> However, I am able to use constellation_cbpsk perfectly from C++. So I
> am guessing it's a SWIG problem.
> Any ideas?

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

No comments:

Post a Comment