kalliope-project / kalliope

Kalliope is a framework that will help you to create your own personal assistant.
https://kalliope-project.github.io/
GNU General Public License v3.0
1.71k stars 229 forks source link

Script neuron does not accept script with arguments #680

Open gl-bars opened 1 year ago

gl-bars commented 1 year ago

Documentation has an example of running script with argument:

- script:
  path: "/path/to/script.sh {{ my_var }}"

but it actually fails:

  File "kalliope/core/NeuronLauncher.py", line 62, in start_neuron
    instantiated_neuron = NeuronLauncher.launch_neuron(neuron)
  File "kalliope/core/NeuronLauncher.py", line 41, in launch_neuron
    return Utils.get_dynamic_class_instantiation(package_name="neurons",
  File "kalliope/core/Utils/Utils.py", line 150, in get_dynamic_class_instantiation
    return klass(**parameters)
  File "kalliope/neurons/script/script.py", line 37, in __init__
    if self._is_parameters_ok():
  File "kalliope/neurons/script/script.py", line 64, in _is_parameters_ok
    raise InvalidParameterException("Script not found or is not a file.")
kalliope.core.NeuronModule.InvalidParameterException: Script not found or is not a file.

This happens because script.py runs os.path.isfile check on the whole command line. Should it probably use shlex.split to separate the command from arguments?