DSL-rule OH3: Failed to execute commandline

While migrating old OH2 DSL-rules to OH3 I encountered the following:


python /etc/openhab/scripts/webcamS.py


	var String cmd = "python /etc/openhab/scripts/webcamS.py"
	var String bilderjson = executeCommandLine(Duration.ofSeconds(120), cmd, wetterpic, tempout, tempin, pressure, "0")

The logs say:

2021-05-25 18:09:45.808 [DEBUG] [c.internal.ExecWhitelistWatchService] - Updated command whitelist: [python /etc/openhab/scripts/webcamS.py, speedtest -f json]
2021-05-25 18:09:51.400 [WARN ] [rg.openhab.core.io.net.exec.ExecUtil] - Failed to execute commandLine '[python /etc/openhab/scripts/webcamS.py, mostlysunny, 12.14, 12.36, 87.01, 0]'

What did I miss?
sudo -u openhab python /etc/openhab/scripts/webcamS.py works.

OH3 syntax of executeCommandLine expects all arguments to be separated by commas.
That means you need to use python and /etc/openhab/scripts/webcamS.py as separate parameter.
python itself would not be required if shebang in the header of the script would be used.

1 Like

Whitelist is not used for executeCommandLine()

1 Like

Thanks a lot! yeah, shebang is in the script - old habit. works now!

Ah, good to know!