简体   繁体   English

GNU Radio (Companion) 在变量替换上给出 Python 语法错误

[英]GNU Radio (Companion) gives Python Syntax Error on variable substitution

I'm trying out GNU Radio (Compantion) for the first time right now, having bought an RTL SDR (the SDR SMARt from NooElec) and trying to build a simple FM radio.我现在第一次尝试 GNU Radio (Compantion),购买了 RTL SDR(NooElec 的 SDR SMARTt)并尝试构建一个简单的 FM 收音机。 I have a (reasonably correct) flowgraph and Compilation runs without errors, but when I try to run it, I get the following Error:我有一个(相当正确的)流程图并且编译运行没有错误,但是当我尝试运行它时,出现以下错误:

Generating: '/home/fl0wless/.grc_gnuradio/Radio.py'

Executing: /usr/bin/python3 -u /home/fl0wless/.grc_gnuradio/Radio.py

  File "/home/fl0wless/.grc_gnuradio/Radio.py", line 42
    self.samp_rate = samp_rate = 2M
                                  ^
SyntaxError: invalid syntax

Instead of substituting the value of samp_rate , it seems the whole expression is simply inserted.似乎没有替换samp_rate的值,而是简单地插入了整个表达式。 This also happens with all other variables, if I remove the current one another appears.如果我删除当前的另一个变量,所有其他变量也会发生这种情况。

Is this a (known) bug?这是一个已知的错误? The GNU Radio installation is fresh, as is the python3 one, I haven't tampered with anything (yet). GNU Radio 安装是全新的,python3 也是如此,我还没有篡改任何东西(还)。

Forget it, sorry, I found the problem: while Gnu Radio Companion will show you variables truncated with units (k, M, etc.) one cannot, in fact, enter them inside variable fields as they are not translated into their original python friendly numeric values.算了,抱歉,我发现了问题:虽然 Gnu Radio Companion 会向您显示用单位(k、M 等)截断的变量,但实际上无法将它们输入到变量字段中,因为它们没有被翻译成原始的 python 友好数值。 So my mistake was literally entering 2M into the field.所以我的错误是字面上输入了 2M。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM