openHab python script launcher

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!!

Please post your rule that includes the executeCommandLine.

See

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

Hello Alessandro,

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

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

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

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

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

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