Slot Programs - Exec format error

Need to get a list of defined devices from my smart home software. That’s why I tried the Slot Programs Feature. I did exactly as written in the documentation.
But I get the following error when starting the training:

[ERROR:83378277] __main__: Training failed: <Task: ini_graph>: TaskError
PythonAction Error
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/doit/action.py", line 424, in execute
returned_value = self.py_callable(*self.args, **kwargs)
  File "/usr/share/rhasspy/rhasspy/train/__init__.py", line 332, in do_intents_to_graph
    jsgf.walk_expression(sentence, number_transform, replacements)
  File "/usr/local/lib/python3.6/dist-packages/rhasspynlu/jsgf.py", line 159, in walk_expression
    new_item = walk_expression(expression.items[i], visit, replacements)
  File "/usr/local/lib/python3.6/dist-packages/rhasspynlu/jsgf.py", line 159, in walk_expression
    new_item = walk_expression(expression.items[i], visit, replacements)
  File "/usr/local/lib/python3.6/dist-packages/rhasspynlu/jsgf.py", line 181, in walk_expression
    for i in range(len(key_replacements)):
  File "/usr/share/rhasspy/rhasspy/train/__init__.py", line 315, in __len__
    self.maybe_generate()
  File "/usr/share/rhasspy/rhasspy/train/__init__.py", line 303, in maybe_generate
    command, universal_newlines=True
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/profiles/de/slot_programs/devices'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/quart/app.py", line 1471, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/usr/local/lib/python3.6/dist-packages/quart/app.py", line 1519, in dispatch_request
    return await handler(**request_.view_args)
      File "app.py", line 589, in api_train
    raise Exception(f"Training failed: {result.reason}")
Exception: Training failed: <Task: ini_graph>: TaskError
PythonAction Error
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/doit/action.py", line 424, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "/usr/share/rhasspy/rhasspy/train/__init__.py", line 332, in do_intents_to_graph
    jsgf.walk_expression(sentence, number_transform, replacements)
  File "/usr/local/lib/python3.6/dist-packages/rhasspynlu/jsgf.py", line 159, in walk_expression
    new_item = walk_expression(expression.items[i], visit, replacements)
  File "/usr/local/lib/python3.6/dist-packages/rhasspynlu/jsgf.py", line 159, in walk_expression
    new_item = walk_expression(expression.items[i], visit, replacements)
  File "/usr/local/lib/python3.6/dist-packages/rhasspynlu/jsgf.py", line 181, in walk_expression
    for i in range(len(key_replacements)):
  File "/usr/share/rhasspy/rhasspy/train/__init__.py", line 315, in __len__
    self.maybe_generate()
  File "/usr/share/rhasspy/rhasspy/train/__init__.py", line 303, in maybe_generate
    command, universal_newlines=True
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/profiles/de/slot_programs/devices'

Any idea, what this OSError could be?

Hi @schnopsi
Looks like incorrect syntax in your slots
Could you provide it here?

As I just found out, I didn’t exactly do as in the documentation :wink:. So deleted everything and tried again with copy&paste from the docs.

Error has changed to:

[ERROR:85289050] __main__: Training failed: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/quart/app.py", line 1471, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/usr/local/lib/python3.6/dist-packages/quart/app.py", line 1519, in dispatch_request
    return await handler(**request_.view_args)
  File "app.py", line 589, in api_train
    raise Exception(f"Training failed: {result.reason}")
Exception: Training failed: 

The created file is:

#/usr/bin/env bash

echo 'red'
echo 'green'
echo 'blue'

Still want to see the slots? It’s a larger file.

Haha) I just thought you started with a small amount of items
So am I right, if you remove newly created slot program Training works with no error?
To be sure the the problem is in this small file :wink:

As soon as i remove the reference $colors from my sentence.ini it’s working again, yes.
But I’ll try again with an empty profile. This is somehow mysterious.

Empty profile. First two trainings worked. Then I added the “colors”-file, put a reference in sentences.ini and tried training again. Failed with:

Training failed: <Task: ini_graph>: TaskError PythonAction Error Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/doit/action.py", line 424, in execute returned_value = self.py_callable(*self.args, **kwargs) File "/usr/share/rhasspy/rhasspy/train/__init__.py", line 332, in do_intents_to_graph jsgf.walk_expression(sentence, number_transform, replacements) File "/usr/local/lib/python3.6/dist-packages/rhasspynlu/jsgf.py", line 159, in walk_expression new_item = walk_expression(expression.items[i], visit, replacements) File "/usr/local/lib/python3.6/dist-packages/rhasspynlu/jsgf.py", line 159, in walk_expression new_item = walk_expression(expression.items[i], visit, replacements) File "/usr/local/lib/python3.6/dist-packages/rhasspynlu/jsgf.py", line 181, in walk_expression for i in range(len(key_replacements)): File "/usr/share/rhasspy/rhasspy/train/__init__.py", line 315, in __len__ self.maybe_generate() File "/usr/share/rhasspy/rhasspy/train/__init__.py", line 303, in maybe_generate command, universal_newlines=True File "/usr/lib/python3.6/subprocess.py", line 356, in check_output **kwargs).stdout File "/usr/lib/python3.6/subprocess.py", line 423, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.6/subprocess.py", line 729, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 8] Exec format error: '/profiles/de/slot_programs/colors'

BTW, how do you use reference? It should be in brackets ($colors)
Sorry if I’m too nerdy :nerd_face:

[GetTime]
wie spät ist es ($colors)
sag mir die uhrzeit

Just checked the docs… and found Shebang mentioned
Should it be #! ?
Not just #

At the beginning of the file

Haha, you’re completely right :laughing:
Embarrassing…

Thanks a lot!

Do you know how to change the docs?

Glad you’ve got it working :upside_down_face:

You can amend the file and create pull request on git hub

Or I think it’s possible just to open an issue with details of this “bug” :crazy_face:

1 Like