GNU Radio OOT块:AttributeError:“模块”对象没有属性“ pthread”使用ZeroMQ套接字

问题描述

我已经使用C ++在GNU Radio中开发了Out of tree块。我正在使用ZMQ套接字(通过库实现)通过两个线程传递数据。

当我尝试在GNU Radio同伴中执行OOT块(pthread块)时,出现的是:AttributeError:'module'对象没有属性'pthread'。

Traceback (most recent call last): File "/home/itupac/workarea-gnuradio/Labs/pthread/top_block.py",line 161,in <module> main() File "/home/itupac/workarea-gnuradio/Labs/pthread/top_block.py",line 149,in main tb = top_block_cls() File "/home/itupac/workarea-gnuradio/Labs/pthread/top_block.py",line 116,in __init__ self.pthread_pthread_0 = pthread.pthread() AttributeError: 'module' object has no attribute 'pthread'

这些天,我一直在尝试解决错误...我在顶部CMakeLists.txt中在以下行中添加了单词ZEROQM:set(GR_required_COMPONENTS RUNTIME ZEROMQ),但仍然无法正常工作。

我在github中有我的代码块的OOT代码https://github.com/isaactd92/gr-pthread.git

我非常感谢您在此问题上的任何帮助。 问候 以撒。

解决方法

我解决了这个问题。 线索在CMakeLists.txt中:

  1. 下载并安装数据包:https://github.com/zeromq/cppzmq。这将带来zmq.hpp库和ZeroMQconfig.cmake
  2. 配置/** * @NApiVersion 2.x * @NScriptType ClientScript */ define(["N/search"],function(search){ function fieldChanged(ctx){ if(ctx.fieldId == 'custbody_rate_definer'){ // use the id of your custom body field var definer = ctx.currentRecord.getValue({fieldId:ctx.fieldId}); var rate = null; // use the actual values from your rate lookup custom record for the search search.create({ type:'customrecord_custom_rates',filters:[ ['custrecord_max_val','greaterthan',definer],'AND',['custrecord_min_val','lessthan',],columns:[ 'custrecord_rate' ] }).run().each(function(result){ //this assumes your rates don't overlap and nothing else needs to be done to disambiguate the rate records (e.g. valid during some set of dates) rate = parseFloat(result.getValue({name:'custrecord_rate'})) || 0; return false; }); if(rate) alert('The rate is '+ rate); } } return { fieldChanged:fieldChanged; } }); 中的CMakeLists.txt。在(${SOURCE_DIRECTORY})中添加find_package(ZeroMQ)
  3. 配置/ lib中的CMakeLists.txt。在# Find gnuradio build dependencies中包含zmq。

正常构建您的OOT块,它将识别zmq套接字并消失该问题:)