0

Im trying to run a python script through kodi 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?

#!/usr/bin/python2
import subprocess

subprocess.call('ssh pi@192.168.1.14 -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)

See Error Below.

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 pi@192.168.1.14 -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<--
Bkafi
  • 3
  • 3

1 Answers1

0

Termux on Android is it's own self-contained environment. The commands within it are not part of the Android core system and not in any sort of path that Kodi will know by default. If you run which ssh you'll see it is somewhere like /data/data/com.termux/files/usr/bin/ssh. I'm not sure if Kodi will be able to use that, though. Check out the following, it might help:

https://github.com/termux/termux-app/issues/77

robbie.huffman
  • 423
  • 4
  • 12