Kodi Community Forum

Full Version: Executing python script from keymap results in script execution loop
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a very simple python script set up in my keymap.xml file that executes a simple script. I have a URC remote control that seeds the keymap command to Kodi via IR, and it executes the script.

The problem that i'm running into is that it will continue executing the script even after I release the button on the remote. It continues spawning new processes until the system eventually crashes after a few minutes. I configured the remote so that it cannot send more than 1 repeat command, and if I execute the script from the command line, it executes once and works as designed.

I've been messing with it for a few hours and i'm stumped. Any suggestions? Thanks in advance!


Keymap Entry:
<f mod="ctrl,alt">RunScript(/storage/.kodi/userdata/vera/Bedtime.py)</f>

Bedtime.py:
import urllib
import sys
urllib.urlopen('http://192.168.1.22:3480/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=3')
sys.exit()
Figured this out. It ended up being an issue with the URC remote learned IR command behavior. I was learning commands off an IR keyboard and it turns out the URC remote is pretty sensitive to recording multiple keystrokes at the same time. It turns out it was sending the same command inside itself 50 or 60 times because i was holding down the keys too long on the learn IR command. I re-learned the command on the remote and made sure to press all combined keys at exactly the same time so it only sent the command once. This took a handful of attempts to master but I finally got it. Hopefully this helps someone else out there with a similar URC setup because once it works, it is pretty slick.