我收到消息:"Bad import syntax:" 当我尝试在我的 gnuradio 流程图中导入 python 函数时

I got the message: "Bad import syntax:" when I try to import a python function inside my gnuradio flowgraph

我正在尝试在 gnuradio 页面上完成本教程: https://wiki.gnuradio.org/index.php/TutorialPythonFunctions

它看起来很简单,但当我尝试导入我的函数 "testpy".

时收到消息 "bad import syntax"

有人遇到同样的问题或知道如何解决吗?

不幸的是,这很神秘。你要在方框里写的是一个Python import statement, 不仅仅是要导入的模块的名称。即写

import testpy

而不仅仅是 testpy.

您还可以使用 from <module> import <name>, <name>import 语句的所有其他形式。 (这就是它需要语句而不仅仅是模块名称的原因:因此您可以进行任何一种导入。)