Kodi Community Forum

Full Version: Running a script via os.system not working..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Just dipping my toes in the water of python while trying to get my backlighting relays switching via XBMC.
I've cobbled together a very simple pyhton script that pops a notification on xbmc's gui then runs a bash script which has the commands to en/disable some usb relays that control my lighting.
Running the python script from the terminal works fine, but launching via XBMC doesn't seem to run the bash script.
xbmc.log shows nothing and says the script completed without error, and nothing gets displayed onscreen ( apart from the desired notification Smile )

Here is the offending line;
Code:
import os
os.system('/home/xbmc/shellscripts/atmoon.sh')

Should I be using a different function to launch something like this ?

Cheers for any pointers.
is it executable? try:
Code:
chmod a+x atmoon.sh
OR
Code:
import os
os.system('[b]sh[/b] /home/xbmc/shellscripts/atmoon.sh')
@Swifty
See here how to produce a debug log:
http://www.xbmc.org/wiki/?title=HOW-TO_S...Bug_Report

that'll help you see what exactly XBMC is trying to do, as well as share the problem details with others.
Thanks for the pointers guys.
I managed to figure it out this morning after a little sleep Smile
I realised when I was using ssh to test the python script manually I had logged in with a different account.. one which I had added to the sudoers file to bypass the password request.
Forgetting that xbmc was running under a different account I didn't clock on to this and thought something in my script was at fault... it was simply failing to run correctly because the xbmc account needed the password entering before I could run the script with 'sudo'.