#1051778 gnuradio: Block "RFNoC Graph (Device)" cannot be used in GNURadio companion

Package:
gnuradio
Source:
gnuradio
Description:
GNU Radio Software Radio Toolkit
Submitter:
Thomas Lorblanchès
Date:
2023-09-12 12:33:05 UTC
Severity:
normal
#1051778#5
Date:
2023-09-12 12:21:03 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
Under GNURadio companion (Debian 12), I want to use the "RFNoC Graph (Device)" block.
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
Drag the "RFNoc Graph (Device)" menu entry and drop it on the flowgraph window.
   * What was the outcome of this action?
The block does not appear in the flowgraph window.
The following error messages are printed in the terminal:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gnuradio/grc/core/blocks/_templates.py",
line 77, in render
    return template.render(**namespace)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mako/template.py", line 439, in render
    return runtime._render(self, self.callable_, args, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/mako/runtime.py", line 874, in _render
    _render_context(
  File "/usr/lib/python3/dist-packages/mako/runtime.py", line 916, in
_render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/usr/lib/python3/dist-packages/mako/runtime.py", line 943, in
_exec_template
    callable_(context, *args, **kwargs)
  File "memory:0x7f3068b802d0", line 43, in render_body
  File "/usr/lib/python3.11/ast.py", line 64, in literal_eval
    node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<unknown>", line 0

SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gnuradio/grc/gui/Application.py", line
409, in _handle_action
    flow_graph_update()
  File "/usr/lib/python3/dist-packages/gnuradio/grc/gui/Application.py", line
110, in flow_graph_update
    fg.update()
  File "/usr/lib/python3/dist-packages/gnuradio/grc/gui/canvas/flowgraph.py",
line 192, in update
    self.rewrite()
  File "/usr/lib/python3/dist-packages/gnuradio/grc/core/FlowGraph.py", line
232, in rewrite
    self.renew_namespace()
  File "/usr/lib/python3/dist-packages/gnuradio/grc/core/FlowGraph.py", line
284, in renew_namespace
    for variable_block in self.get_variables():
                          ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gnuradio/grc/core/FlowGraph.py", line
73, in get_variables
    return expr_utils.sort_objects(variables, attrgetter('name'),
methodcaller('get_var_make'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gnuradio/grc/core/utils/expr_utils.py",
line 61, in sort_objects
    id2expr = {get_id(obj): get_expr(obj) for obj in objects}
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gnuradio/grc/core/utils/expr_utils.py",
line 61, in <dictcomp>
    id2expr = {get_id(obj): get_expr(obj) for obj in objects}
                            ^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gnuradio/grc/core/blocks/block.py", line
396, in get_var_make
    return self.templates.render('var_make')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gnuradio/grc/core/blocks/_templates.py",
line 79, in render
    raise TemplateError(error, text)
gnuradio.grc.core.errors.TemplateError: (SyntaxError('invalid syntax',
('<unknown>', 0, 0, '', 0, 0)), '<%\n    import ast\n    # Sanitize\n
graph_args = ast.literal_eval(dev_addr.strip())\n    dev_args_s =
ast.literal_eval(dev_args.strip())\n    clock_source_s =
ast.literal_eval(clock_source.strip())\n    time_source_s =
ast.literal_eval(time_source.strip())\n    # Build full dev args\n    if
dev_args_s:\n        graph_args += f",{clock_source_s}"\n    if
clock_source_s:\n        graph_args += f",clock_source={clock_source_s}"\n
if time_source_s:\n        graph_args +=
f",time_source={time_source_s}"\n%>\nself.rfnoc_graph = ${id} =
uhd.rfnoc_graph(uhd.device_addr("${graph_args}"))\n')

   * What outcome did you expect instead?

*** End of the template - remove these template lines ***

#1051778#10
Date:
2023-09-12 12:28:47 UTC
From:
To: