Build an open future with us.

Invest in Mycroft and become a community partner.

Question about skill permissions and launching other programs using skills


My last forum thread was me asking about the possibility of using HZeller’s library to display visual information regarding the current skill on a matrix display. Since, I’ve done some more research into the matter and have ran into a few roadblocks. I had a few workarounds in mind and wanted to see if anyone could confirm that my ideas are possible.

Python scripts that use HZeller’s library need root permissions according to the Git readme. This is supported by the fact that all examples are ran as sudo. Assuming that Mycroft skills do not automatically run under the ‘root’ user, I figured I must either find a way to launch another script that controls the leds by modifying existing skills to include a sudo command, or find a way to give skills root permissions.

Can I launch another Python program from a skill while retaining full Mycroft functionality? I apologize if this question sounds silly, I’m quite new to Mycroft and programming in general.

I am going to edit the sudoers file to allow the scripts that control the matrix to run with root permissions, and I won’t list my password in plain text.

Normally I would just try this all out myself but I haven’t actually purchased any on the hardware yet. Just trying to plan ahead as much as possible. Thanks in advance for any information.

EDIT: Forgot to mention that I’d be starting the other scripts using os.system(). Any other solutions for running a seperate script with root permissions is appreciated.


Running as sudo

It is possible for a Skill to use linux system commands as sudo, but it requires additional setup on the part of the Skill user. The Aircrack Skill by Jon Stratton is a great example of this.

Running another Python program

You can use Python libraries from within your Skill by importing them, and also use Linux system functions by using the relevant library;

import os

This would be one way to call another Python script.

Another way is to use Python modules, but we haven’t explored this a lot yet.