2018-12-17, 00:42
Im trying to run a python script through kodi submenu button which opens a SSH connection to my remote Raspberry Pi and runs a .sh script. However it sems like Kodi cant resolve paths very well.
I have ran this same python script from termux and it runs fine.
Not sure if i have to use xbmc.translatepath. Any kodi legends out there know what im doing wrong?
If theres a better way of doing this im all ears
XBMC.RunScript(special://home\addons\script.hyperion\hyperion_on.py)
Remote script on Pi hyperion_on.sh
Error:
I have ran this same python script from termux and it runs fine.
Not sure if i have to use xbmc.translatepath. Any kodi legends out there know what im doing wrong?
If theres a better way of doing this im all ears
XBMC.RunScript(special://home\addons\script.hyperion\hyperion_on.py)
Code:
#!/usr/bin/python2
import subprocess
subprocess.call('ssh [email protected] -p 22 -i /storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.hyperion/.ssh/id_rsa bash "/home/pi/hyperion_on.sh"', shell=True)
Remote script on Pi hyperion_on.sh
Code:
echo '{ "command": "clearall"}' | nc 192.168.1.14 19444
Error:
Code:
ERROR: EXCEPTION Thrown (PythonToCppException) :
-->Python callback/script returned the following error<--- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.OSError'>
Error Contents: [Errno 2] No such file or directory
Traceback (most recent call last):
File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.hyperion/hyperion_on.py", line 17, in <module> subprocess.call('ssh [email protected] -p 22 -i /storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.hyperion/.ssh/id_rsa bash "/home/pi/hyperion_on.sh"', shell=True)
File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux- androideabi-android-21/lib/python2.7/subprocess.py", line 523, in call
File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux- androideabi-android-21/lib/python2.7/subprocess.py", line 711, in __init__ File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux- androideabi-android-21/lib/python2.7/subprocess.py", line 1343, in _execute_child
OSError: [Errno 2] No such file or directory -->End of Python script error report<--