【问题标题】:Relative Path to Files in GNU Radio CompanionGNU Radio Companion 中文件的相对路径
【发布时间】:2018-02-27 08:38:33
【问题描述】:

当我尝试在 GNU Radio 中使用相对路径时(例如,对于接收器或源块),它会出错并显示“无法打开文件”。

假设路径是相对于 .grc 文件位置的位置。

当 GRC 生成 python 文件时,在命令行上运行该文件会产生所需的结果。它只是不能通过 GNU Radio Companion 界面工作。

【问题讨论】:

    标签: gnuradio-companion


    【解决方案1】:

    GNU Radio Companion (GRC) 路径与 GRC 的启动位置相关。

    如果脚本打算从其包含目录运行,则可以将“Python 模块”块添加到 GRC 中,内容如下:

    import os
    
    script_path = os.path.dirname(os.path.realpath(__file__))
    os.chdir(script_path)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-21
      • 1970-01-01
      • 2020-06-14
      • 2019-08-11
      • 1970-01-01
      • 2022-07-02
      相关资源
      最近更新 更多