Thing exec command not run python file on windows 10

i run openhab 2.5.9 on windows 10,
i success to run the py file via CMD from windows.
this is my thing file:

Thing exec:command:SwitcherAll [ command="C:/Python/python.exe  C:/openHAB2/conf/scripts/switcher.py 2" , interval=60 , timeout=10 , autorun=false]
Thing exec:command:SwitcherSet [ command="C:/Python/python.exe  C:/openHAB2/conf/scripts/switcher.py %2$s" , interval=0 , autorun=false]
Thing network:pingdevice:Switcher [ hostname="192.168.1.26", retry=5, timeout=5000, refreshInterval=3600000 ]

If nothing happens, perhaps you have not installed the exec binding.

Otherwise there should be some info in your openhab.log that you could share with us.

I have exec binding installed
And I do not see anything related to exec when I try to run the command

Perhaps you would tell us how you try to run the command, and what result you are expecting to see where.

1 Like

exec binding has a whitelist now, I believe. Did you whitelist the command?

A whitelist problem would produce a log …

1 Like

I’m trying to control the switch via a python script
And I wrote in the whitelist file:

C: /Python/python.exe C: /openHAB2/conf/scripts/switcher.py 2
C: /Python/python.exe C: /openHAB2/conf/scripts/switcher.py% 2 $ s

What switch? You mean some the device the script is supposed to work on, maybe?
What do you do, that you expect to make the exec binding trigger?
Have you any Items linked to your exec Things? Perhaps you can tell us about that.

I understand language problems can make it hard work, but telling us nothing about your set up makes it harder.

Windows is backward so it uses backslashes instead of slashes. If the string is quoted you may need to try double backslashes.

This is a guide someone wrote for this switch:

And that it can be run via openhab python script

For the OS itself that is correct.
Speaking about python you could use both a single forward slash or escaped backslash ( double backslash ). As far as I know this is the same for java so a single forward slash should be fine.
See also Execute python command with string attached in exec=">: format - #8 by rossko57 where a user used the exec binding and at the end used forward slashes.

1 Like

That would mean backslashes are needed in the path for python.exe.

depends on who/what needs to interpret the path. Is it the OS or is it done by Java.

problem solved:
After I checked with the guy who wrote the script, it turns out I put the wrong switcher.py file in the beginning and now it works fix.
Thanks to everyone for your comments !.

1 Like

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