nasa/fprime-gds

Incorrect variable reference causes exception when running "fprime-cli channels"

Closed this issue · 2 comments

F´ Version 3.x
Affected Component

Problem Description

When running the channels sub-command of the fprime-cli tool, I run into the following exception:

$ fprime-cli channels -d <path/to/my/deployment/dictionary.xml>
2022-06-16 10:28:58: gncStub.NumImuRecordsReceived (33537) (2(0)-1655400538:842603) 42
Traceback (most recent call last):
  File "/home/jpldev/repos/alt/cadre-fsw/venv/bin/fprime-cli", line 33, in <module>
    sys.exit(load_entry_point('fprime-gds', 'console_scripts', 'fprime-cli')())
  File "/home/jpldev/repos/alt/cadre-fsw/fprime-gds/src/fprime_gds/executables/fprime_cli.py", line 410, in main
    function(**argument_dict)
  File "/home/jpldev/repos/alt/cadre-fsw/fprime-gds/src/fprime_gds/executables/fprime_cli.py", line 236, in command_func
    channels.ChannelsCommand.handle_arguments(*args, **kwargs)
  File "/home/jpldev/repos/alt/cadre-fsw/fprime-gds/src/fprime_gds/common/gds_cli/base_commands.py", line 235, in handle_arguments
    cls._execute_query(connection_info, search_info, kwargs["timeout"])
  File "/home/jpldev/repos/alt/cadre-fsw/fprime-gds/src/fprime_gds/common/gds_cli/base_commands.py", line 209, in _execute_query
    misc_utils.repeat_until_interrupt(print_upcoming_item, "NOW")
  File "/home/jpldev/repos/alt/cadre-fsw/fprime-gds/src/fprime_gds/common/gds_cli/misc_utils.py", line 53, in repeat_until_interrupt
    new_args = func(*args)  # lgtm [py/call/wrong-arguments]
  File "/home/jpldev/repos/alt/cadre-fsw/fprime-gds/src/fprime_gds/common/gds_cli/base_commands.py", line 203, in print_upcoming_item
    min_start_time = predicates.greater_than(item.get_time())
NameError: free variable 'item' referenced before assignment in enclosing scope

The code snippet shown below is where the problem occurs. On line 203, the variable name item is used, but it looks like it should be referencing the variable item_ instead, which is defined on line 199.
https://github.com/fprime-community/fprime-gds/blob/9edae8d750935f7b7ff06fc587fdbb152c4807e8/src/fprime_gds/common/gds_cli/base_commands.py#L199-L207

This issue is known, and is fixed in #60

Was merged