Change python version in openhab

Hi, I’m trying to execute a python script that requires Python3

val results = executeCommandLine("/etc/test.py",1000)
logInfo("Test", results)

I had some problems with permissions, so I changed the file permission to 777 and OpenHab is now correctly trying to execute the file. I also changed the default Python version on my Raspberry to 3.7. The script executes correctly when I run it via SSH, but with OpenHab I get the exact same syntax error as using the old Python version. Is there some intern OpenHab configuration for Python I have to change? I think I have read every forum on this topic but didn’t find any answer.
Any help would be highely appreciated.

Have you tried:

executeCommandLine("python3 /etc/test.py",1000)

Yes, thanks, it hit me right after posting this topic.

val results = executeCommandLine("python3 /etc/test.py", 5000)

However, the script sometimes stops in the middle of executing with error

Rule ‘test’: An error occurred during the script execution: null

But I guess it’s some OpenHAB mistake I cannot solve, because it happens with other rules as well from time to time.

That’s a message from a rule, not from the python script. If you want some help with that, show the rule please.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.