Launching script via remote and debugging help - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: Launching script via remote and debugging help (/showthread.php?tid=84144) |
Launching script via remote and debugging help - Targettio - 2010-10-27 Good morning, I have sortTV set up to run every few hours, and I have a button on my remote programmed to update my library. But I am trying to write a little python script that combines the 2 activities, so that when I press the update library button on my remote the script activates my sort TV bat file, waits a few seconds and then updates the library. This is the first time I have looked at python, so bare with me. Quote: import xbmc I think this will work, but can any one spot any obvious faults? The next question how do I launch this from my keyboard.xml? I think it works like this: Quote:<d mod="ctrl,alt"> xbmc.executescript('C:\\Program Files\\XBMC\\Scripts\\Updater.py')</d> Is that right? Is there a way to use a relative path to the script (rather than absolute path)? - Targettio - 2010-10-28 Hi guys, I got all the xbmc stuff working (can fire the script from xbmc and notification pop up correctly etc) but cant get the bat script to execute: Quote:import os I have tried single quotes ', double quotes ", with chdir, without chdir nothing seems to work. I have googled my ass off, but they all just say os.system() will do it. Some one please help - pgoeri - 2010-10-28 Just a guess, but maybe you have to execute cmd.exe with the batch file as parameter, since the batch file itself isn't really a executable. - Targettio - 2010-10-29 It was to do with the windows file system... I don't really understand it, but if you put a "r" in front of the path it magically works. Quote:os.system(r"C:\strawberry\Z_Sort_TV\SortTV.bat") I also simplified it to a single line once I found the problem. |