Hello
I am trying to install an OOT module into my GNURadio distribution. I
can integrate the module into GRC and use it in the flowgraph. However,
when I try to execute, I get the following Error:
Traceback (most recent call last):
File "./top_block.py", line 76, in <module>
tb = top_block()
File "./top_block.py", line 43, in __init__
self.LTE_Analysis_pbch_bch_0 = LTE_Analysis.pbch_bch(samp_rate)
AttributeError: 'module' object has no attribute 'pbch_bch'
I assume that there is some problem with the SWIG-glue between python
and my C++ code. However, several hours of googling have not brought up
any solution to this issue. As has been posted previously on this list,
this issue "has come up recently" on some installations. I have tried to
install the module and execute it on the GNURadio Live DVD that was
distributed via the mailing list yesterday - yet, the error remains.
Any help on this would be very appreciated!
I have attached some files which I think could be helpful for tracking
the error.
Best regards, Marcel
--
_____________________________
Universität Bern
Institut für Informatik und angewandte Mathematik
Communication and Distributed Systems Research Group
Marcel Stolz, BSc
Master Student
Neubrückstrasse 10
CH-3012 Bern
mailto:marcel.st...@students.unibe.ch
http://www.cds.unibe.ch
/* -*- c++ -*- */
#define LTE_ANALYSIS_API
%include "gnuradio.i" // the common stuff
//load generated python docstrings
%include "LTE_Analysis_swig_doc.i"
%{
#include "LTE_Analysis/pbch_bch.h"
%}
%include "LTE_Analysis/pbch_bch.h"
GR_SWIG_BLOCK_MAGIC2(LTE_Analysis, pbch_bch);
/* -*- c++ -*- */
/*
* Copyright 2014 <+YOU OR YOUR COMPANY+>.
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_LTE_ANALYSIS_PBCH_BCH_H
#define INCLUDED_LTE_ANALYSIS_PBCH_BCH_H
#include "typedefs.h"
#include <LTE_Analysis/api.h>
#include <gnuradio/sync_block.h>
namespace gr {
namespace LTE_Analysis {
/*!
* \brief <+description of block+>
* \ingroup LTE_Analysis
*
*/
class LTE_ANALYSIS_API pbch_bch : virtual public gr::sync_block
{
public:
typedef boost::shared_ptr<pbch_bch> sptr;
/*!
* \brief Return a shared_ptr to a new instance of LTE_Analysis::pbch_bch.
*
* To avoid accidental use of raw pointers, LTE_Analysis::pbch_bch's
* constructor is in a private implementation
* class. LTE_Analysis::pbch_bch::make is the public interface for
* creating new instances.
*/
static sptr make(uint32 samp_rate);
//getters and setters
virtual void set_samp_rate(uint32 samp_rate) = 0;
virtual uint32 samp_rate() = 0;
};
} // namespace LTE_Analysis
} // namespace gr
#endif /* INCLUDED_LTE_ANALYSIS_PBCH_BCH_H */
<block>
<name>Pbch bch</name>
<key>LTE_Analysis_pbch_bch</key>
<category>LTE_ANALYSIS</category>
<import>import LTE_Analysis</import>
<make>LTE_Analysis.pbch_bch($samp_rate)</make>
<param>
<name>Sample Rate</name>
<key>samp_rate</key>
<type>int</type>
</param>
<sink>
<name>in</name>
<type>complex</type>
</sink>
</block>
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Wed Oct 22 10:46:07 2014
##################################################
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import uhd
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from optparse import OptionParser
import LTE_Analysis
import time
class top_block(gr.top_block):
def __init__(self):
gr.top_block.__init__(self, "Top Block")
##################################################
# Variables
##################################################
self.usrp_bandwidth = usrp_bandwidth = 10000000
self.samp_rate = samp_rate = 15360000
self.center_freq = center_freq = 806000000
##################################################
# Blocks
##################################################
self.uhd_usrp_source_0 = uhd.usrp_source(
",".join(("", "")),
uhd.stream_args(
cpu_format="fc32",
channels=range(1),
),
)
self.uhd_usrp_source_0.set_samp_rate(samp_rate)
self.uhd_usrp_source_0.set_center_freq(center_freq, 0)
self.uhd_usrp_source_0.set_gain(0, 0)
self.uhd_usrp_source_0.set_bandwidth(usrp_bandwidth, 0)
self.LTE_Analysis_pbch_bch_0 = LTE_Analysis.pbch_bch(samp_rate)
##################################################
# Connections
##################################################
self.connect((self.uhd_usrp_source_0, 0), (self.LTE_Analysis_pbch_bch_0, 0))
def get_usrp_bandwidth(self):
return self.usrp_bandwidth
def set_usrp_bandwidth(self, usrp_bandwidth):
self.usrp_bandwidth = usrp_bandwidth
self.uhd_usrp_source_0.set_bandwidth(self.usrp_bandwidth, 0)
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)
def get_center_freq(self):
return self.center_freq
def set_center_freq(self, center_freq):
self.center_freq = center_freq
self.uhd_usrp_source_0.set_center_freq(self.center_freq, 0)
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
(options, args) = parser.parse_args()
tb = top_block()
tb.start()
raw_input('Press Enter to quit: ')
tb.stop()
tb.wait()
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio