I am trying to use the cec PIP package found here. I have the following code in $OPENHAB_CONF/automation/jsr223/python/personal/test_cec_command.py:
tv = cec.Device(cec.CECDEVICE_TV)
This gives the error output in the logs, because it cannot find the cec package:
2020-04-01 20:57:29.453 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/python/personal/test_cec_command.py': ImportError: No module named
cec in <script> at line number 3
I did install it and running it as openhabe user works as expected:
You need the library and compile parts listed on the GitHub page. Perhaps you somehow need to symlink Jython so it appears as Python 2.
Even that that may still not work, especially sonce the project says it has not been verified on a Pi,
That makes sense. I am completely new to Jython. I don’t even have the jython command in my path:
$ sudo -u openhab jython test_cec_command.py
sudo: jython: command not found
Do I need to configure something for this? Perhaps I should do some long reading before continuing. Perhaps you could point me to an entry point to some relevant resources (Jython related and OpenHAB specific)? That’d be great!
How did you install it? If you used a standalone jar, then there’s more that you could do. However, if you are new to Jython/Python, then I think it would be best to back up and keep things simple. Once the package is in the python.path, you can run it through OH (if it is compatible with Jython). BTW, Jython 2.7.2 had been released and has better compatibility.
I did not install Jython at all. I thought, that since OpenHAB uses it, it is installed. But now I realize I did not install any package for it. It was just the JAR. I am somewhat familiar with Python BTW - just not Jython.
I will try adding the package to python.path. It is currently located here: