executeCommandLine being executed but not responding

Hello, I am trying to send a I2c command via the OpenHab2 to the raspberry pi. My target is press the switch ON and the command to send a relay on (python code) is executed.

RULE:

rule: “Powe on”
when
Item zone1 received command
then
if(zone1.stat==ON){

             executeCommandLine("python /etc/openhab2/scripts/relay1config.py")
         }

ITEMS

   Switch zone1 "zone 1"

SITEMAP

sitemap home label=“home”

{
Frame label= “Light Control”
{
Switch item=zone1
}

}

Do I need to do anything else? the code run in the LogViwer but it does not execute anything. If I run my code it is working normally.

First please use the code fences when posting code

Second, try debugging:

rule: “Powe on”
when
    Item zone1 received command
then
    if (zone1.stat == ON) {
        var String str = executeCommandLine("python /etc/openhab2/scripts/relay1config.py")
        logInfo("DEBUG", str)
    }
end

You must specify full path to python.
/usr/bin/python or which python if different on your system.

You need to specify a timeout as a second argument to executeCommandLine if you want to get a result back, otherwise it just executes the command and move on to the next line.

var String str = executeCommandLine("python /etc/openhab2/scripts/relay1config.py", 5000)

Did you try to execute the script as user openhab from the commandline?
Does the user Openhab have all necessary rights to acces I2C or GPIO what ever your skript tries to access?

In the following post all this things are explained in detail. It usees the Exec binding but all this is also relevent for executeCommandLine.