still learning python stuff

This commit is contained in:
Rudis Muiznieks 2022-02-08 16:13:08 -06:00
parent f20f412e50
commit 59dee06c7e
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
1 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,5 @@
import os import os
import thread from threading import Thread
from mycroft import MycroftSkill, intent_handler from mycroft import MycroftSkill, intent_handler
class RunScriptSkill(MycroftSkill): class RunScriptSkill(MycroftSkill):
@ -31,7 +31,8 @@ class RunScriptSkill(MycroftSkill):
script_path = os.path.join(self.script_dir, script) script_path = os.path.join(self.script_dir, script)
if script in self.scripts and os.path.isfile(script_path): if script in self.scripts and os.path.isfile(script_path):
self.speak_dialog('Running', {'script': script}) self.speak_dialog('Running', {'script': script})
thread.start_new_thread(os.system, (script_path)) thread = Thread(target = os.system, args = (script_path, ))
thread.start()
else: else:
self.speak_dialog('NotFound', {'script': script}) self.speak_dialog('NotFound', {'script': script})