openHab python script launcher

python
openhab2
scripts
Tags: #<Tag:0x00007f1e6625ef28> #<Tag:0x00007f1e6625eb40> #<Tag:0x00007f1e6625e898>
(Alessandro Marongiu) #1

Hi there, i’m trying to execute python script with executeCommandLine but i can’t figure it out how to do it…
Python is installed in c:\python (2.7.13), the script is located in c:\openhab2\confg\scripts\spotify.py.
System: windows 10 x64
Exec Binding installed
Thanks a lot!!

0 Likes

(Rich Koshak) #2

Please post your rule that includes the executeCommandLine.

See

0 Likes

(Alessandro Marongiu) #3

I’m first trying on openhab console before creating a rule, i’m having problem on scripting for the exec path and script path…
i have tried with:
executeCommandLine(“c:/python/python c:/openhab2/conf/scripts/spotify.py”)
executeCommandLine(“python/python /conf/scripts/spotify.py”)

and many more syntax

0 Likes

(Alain) #4

Hello Alessandro,

Try : executeCommandLine(“c:/python/python@@c:/openhab2/conf/scripts/spotify.py”)

In the command string, every space must be replaced with @@

0 Likes

(Alessandro Marongiu) #5

Thanks Alain, but nothing happen… also on log:tail

0 Likes

(Alain) #6

If you test your script in the Karaf console, you should escape the quotes surrounding the command string:

smarthome:> executeCommandLine(\“c:/python/python@@c:/openhab2/conf/scripts/spotify.py\”)

This does not apply to .rules file :

when
	Item my_switch received command
then
	executeCommandLine("c:/python/python@@c:/openhab2/conf/scripts/spotify.py")
end
0 Likes

(Alessandro Marongiu) #7

nothing Alain…thanks anyway i don’t understand…
on the log i see “executed commandline […]” but nothing happen…

0 Likes

(Serge Baudot) #8

Have you tried backslashes i.e. executeCommandLine(“c:\python\python@@c:\openhab2\conf\scripts\spotify.py”) ?

0 Likes